Re: [Haskell-cafe] Accumulating related XML nodes using HXT

2006-10-31 Thread Albert Lai
Daniel McAllansmith [EMAIL PROTECTED] writes: Hello. I have some html from which I want to extract records. Each record is represented within a number of tr nodes, and all records tr nodes are contained by the same parent node. This is very poorly written HTML. The original structure

Re: [Haskell-cafe] A type in search of a name...

2006-10-12 Thread Albert Lai
Brian Hulley [EMAIL PROTECTED] writes: You'll never believe it but I've been struggling last night and all of today to try and think up a name for the following type and I'm still nowhere near a solution: data ??? = VarId | VarSym | ConId | ConSym Perhaps Atom.

Re: [Haskell-cafe] Is Haskell a Keynesian language?

2006-10-12 Thread Albert Lai
Henning Thielemann [EMAIL PROTECTED] writes: Here is another approach of questionable classification of languages. :-) A lazy functional program is demand driven, an imperative program is supply driven. So is Haskell a Keynesian language and C++ a Say language? Great, now we can talk

Re: [Haskell] Evil code

2006-10-03 Thread Albert Lai
Thomas Davie [EMAIL PROTECTED] writes: The evil code and CPSness were actually intended to be completely separate entities. I needed (and to a lesser extent now still need), examples that are (a) very higher order, and (b) evil and hard to understand the runtime behaviour of. Generally code

[Haskell-cafe] Re: Haskell web forum

2006-09-21 Thread Albert Lai
: Thomas Conway ] Re: [Haskell-cafe] How can we detect and fix E [ 19: Albert Lai ] Re: [Haskell-cafe] Either e Monad E [ 19: Deokhwan Kim] [ 62: Bas van Dijk] E [ 47: [EMAIL PROTECTED] [Haskell-cafe] Re: Optimization problem [ 51: Ross Paterson

Re: [Haskell-cafe] Either e Monad

2006-09-19 Thread Albert Lai
Deokhwan Kim [EMAIL PROTECTED] writes: Where is the Monad instance declaration of Either e? It is in Control.Monad.Error as well. Strange: the doc doesn't state it. I found out in ghci using: :module +Control.Monad.Error :info Either The relevant result is: instance Error e = Monad (Either

Re: [Haskell] Haskell XML

2006-08-31 Thread Albert Lai
Till Mossakowski [EMAIL PROTECTED] writes: Could someone summarize the pros and cons of HXT versus HaXml versus HSX? From my perspective (therefore perhaps important but hardly comprehensive), HXT vs HaXml: HXT provides arrows. The con is you have to learn arrows. The pro is the arrows

Re: [Haskell-cafe] HaXml question

2006-08-31 Thread Albert Lai
Tim Newsham [EMAIL PROTECTED] writes: I thought this one would be easy but I'm starting to think its not. I am playing with HaXml and I want to transform an XML tree into another tree. The transforms are simple enough, but the kicker is that I want them to be stateful. In this example, the

Re: [Haskell-cafe] Why Not Haskell?

2006-08-08 Thread Albert Lai
Brian Hulley [EMAIL PROTECTED] writes: Also, the bottom line imho is that Haskell is a difficult language to understand, and this is compounded by the apparent cleverness of unreadable code like: c = (.) . (.) when a normal person would just write: c f g a b = f (g a b) All

Re: [Haskell-cafe] Re: Haskell-Cafe Digest, Vol 33, Issue 9

2006-05-11 Thread Albert Lai
Alberto G. Corona [EMAIL PROTECTED] writes: stmcache= newTVar 0 I will explain what this doesn't with an analogy. import Data.IORef notglobal = newIORef True main = do a - notglobal b - notglobal writeIORef a False x - readIORef b print x To better

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-29 Thread Albert Lai
I particularly like OCaml's provision of subtyping. As a member of the ML family, it's module system is also quite formidable. Of course the imperative constructs are also pretty convenient when you just want to be quirky. But I miss the monad do-notation.

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-21 Thread Albert Lai
I offer a simpler, more direct, and pre-existing correspondence between a functional programming construct and unix pipes: http://www.vex.net/~trebla/weblog/pointfree.html Scherrer, Chad [EMAIL PROTECTED] writes: I'm still trying to settle on a feel for good programming style in Haskell.

Re: [Haskell-cafe] Newbie question on Haskell type

2005-10-16 Thread Albert Lai
Huong Nguyen [EMAIL PROTECTED] writes: newtype Parser a = Parser(String - [(a, String)]) [...] parse :: Parser a - String - [(a, String)] parse p cs = p cs \end{code} Try this instead: parse (Parser p) cs = p cs (You forgot to deconstruct! :) )

Re: [Haskell-cafe] a new Monad

2005-09-17 Thread Albert Lai
Malcolm Wallace [EMAIL PROTECTED] writes: Microsoft has announced the following: Developers can also expect a new scripting language for management applications, called Monad. If we embedded the Monad language, as a DSL, into Haskell using a Haskell monad, would we get to call it

Re: [Haskell-cafe] Best way to build strings?

2005-07-23 Thread Albert Lai
Andy Gimblett [EMAIL PROTECTED] writes: show (External p q) = ( ++ show p ++ [] ++ show q ++ ) but to me the extensive use of ++ is not particularly readable. [...] return (%s [] %s) % (self.p, self.q) which to me seems clearer, or at least easier to work out roughly what

[Haskell-cafe] Re: [Haskell] Going nuts

2005-04-20 Thread Albert Lai
Alexandre Weffort Thenorio [EMAIL PROTECTED] writes: outputLine keyno key orgFile = do part1 - getLeft keyno orgFile part2 - getRight keyno orgFile total - part1 ++ (strUpper key) ++ part2 ++ \n newHexFile - openFileEx newfile (BinaryMode WriteMode) hPutStrLn newHexFile

[Haskell-cafe] Re: [Haskell] Y in haskell?

2005-04-20 Thread Albert Lai
Bernard Pope [EMAIL PROTECTED] writes: I also meant to add that I think these solutions are not what Lloyd is after, because they rely on recursive equations, which I believe was avoided in Lloyd's SML code. Those recursive equations are avoided in SML because SML is eager - y f = f (y f)

Re: re-opening a closed stdin?

2002-11-22 Thread Albert Lai
Simon Marlow [EMAIL PROTECTED] writes: One reason, I think, is lazy I/O(*). It's to stop you accidentally [...] (*) kill it! die! die! So you want main = readFile /dev/zero return () to terminate violantly rather than terminate peacefully? :) Seriously, I understand that the IO monad is

Re: Optimisation and unsafePerformIO

2002-10-29 Thread Albert Lai
David Sabel [EMAIL PROTECTED] writes: {-# NOINLINE b #-} b x = if even x then unsafePerformIO getChar else bot bot = bot main = do putChar (b 4) putChar (b 6) I am not a compiler implementer (or lawyer, for that matter :) But I propose this guess. First, both even

Re: Docs missing?

2002-07-24 Thread Albert Lai
The doc RPM package for Red Hat 7.3 suffers the same problem as the SuSE one. Could someone please give a hand-holding guide so that we can fix it ourselves? Please? Please? ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED]

Double your monad in 30 days

2002-03-05 Thread Albert Lai
Ashley Yakeley [EMAIL PROTECTED] writes: Prelude 0 * 2 0 We can generalize this. import Monad double_your_monad_in_30_days :: (MonadPlus M) = M a double_your_monad_in_30_days = mzero `mplus` mzero ___ Glasgow-haskell-users mailing list [EMAIL

Re: Congrats to Mandrake

2002-02-20 Thread Albert Lai
[EMAIL PROTECTED] (Ketil Z. Malde) writes: I'm not sure what the point would be, if they are in the distributions anyway? Isn't it better to install them by apt-get or up2date or whatever? (In fact, I had almost thought manually downloading packages a thing of the past, but then the IT

Re: i368-pc-os2-emx port

2002-02-20 Thread Albert Lai
Simon Marlow [EMAIL PROTECTED] writes: On the other hand, you'd need something like mingw for OS/2 - does such a beast exist? The substring emx refers to an OS/2 version of gcc and libraries that make OS/2 look really like Unix from the programmer's point of view. (It probably even pre-dates

Re: Instances of IArray

2002-02-15 Thread Albert Lai
I had looked into the source code of IArray a bit. Like you have found, (!) is not a class method. In fact, none of the claimed class methods in the doc is a class method, and no class method of IArray is documented. Instead, IArray class methods seem to pertain to implementation details (I

Re: State Transformer

2002-01-11 Thread Albert Lai
testfunc = do r - newSTRef ('x',0) foo r bar r (c,n) - readSTRef r return n Jorge Adriano [EMAIL PROTECTED] writes: Yeap, I could do it like this myself :) The whole problem is with passing the 'r' as a parameter, which is

Re: State Transformer

2002-01-11 Thread Albert Lai
Theodore Norvell [EMAIL PROTECTED] writes: Jorge's question raised a question in my mind. The IOExts module has many of the same features as the ST module, why are there two ways to do the same thing? Is the ST module only there for legacy purposes? My user view is that I appreciate the

Re: ghc image size

2001-12-17 Thread Albert Lai
Mike Gunter [EMAIL PROTECTED] writes: Why is executable size a barrier? 1.64 megabytes (that's the size of the executable I built with GHC most recently) of disk space costs less than half a cent. I don't like this argument. Can I go to a computer store, pay a cent, and get a hard disk

Re: Working character by character in Haskell

2001-10-18 Thread Albert Lai
Andre W B Furtado [EMAIL PROTECTED] writes: [...] For example, suppose function doSomeStuffWith returns its own parameter. Using a 1.5MB file in this case, the Haskell program ends in almost 5 seconds, while the C program ends in less than 0.5 seconds... Is my Haskell program too bad

Re: Student Programming Projects

2001-09-20 Thread Albert Lai
Consider goal-directed theorem prover (or proof checker). Two existing samples are in Lawrence Paulson's ML for the Working Programmer, and yours truly's http://www.cs.utoronto.ca/~trebla/fp/prover/index.html The advantage of mine is it illustrates monads. The advantage of Paulson's is it

Re: [ghc5] getDirectoryContents: trouble on Linux/NFS

2001-04-18 Thread Albert Lai
Volker Stolz [EMAIL PROTECTED] writes: ghc[i] was built from source. The Solaris binary provided on the GHC- download page works fine. I'll investigate FreeBSD as soon as I get home. Feel free to ask for more details regarding machine setup/compilation. I guess a standard question would be:

ghc/rts/parallel/HLComms.c

2001-02-16 Thread Albert Lai
I try to build ghc 4.08.2 with parallelism turned on, i.e., GhcLibsWays=mp. At ghc/rts/parallel/HLComms.c line 550: GarbageCollect(GetRoots); it barfs because the new GarbageCollect() function expects a boolean parameter after the first parameter. (See ghc/rts/Storage.h for example.) Is

Re: ghc/rts/parallel/HLComms.c

2001-02-16 Thread Albert Lai
Albert Lai [EMAIL PROTECTED] writes: I try to build ghc 4.08.2 with parallelism turned on, i.e., GhcLibsWays=mp. At ghc/rts/parallel/HLComms.c line 550: GarbageCollect(GetRoots); it barfs because the new GarbageCollect() function expects a boolean parameter after the first parameter

Confused about enabling parallel ghc

2001-02-14 Thread Albert Lai
I installed ghc 4.08.2 binaries for sparc solaris (and those for intel linux, too), then tried compiling a sample program (the fibonacci one in the user guide) with ghc -parallel. The compiler complained: Could not find interface file for `Prelude' in the directories ./*.hi