Re: [Haskell-cafe] type and class problems compiling code on GHC 6.6

2007-01-29 Thread Albert Lai
José Miguel Vilaça <[EMAIL PROTECTED]> writes: > I had used some code which worked fine on GHC 6.4 and now it don’t compile > on GHC 6.6. I am unable to reproduce your problem. It is saddening that everyone neglects to provide self-contained code for others to reproduce the alleged problems. I

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 nodes, and all records > > nodes are contained by the same parent node. This is very poorly written HTML. The original struct

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 t

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.

[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-18 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 (Eith

Re: [Haskell-cafe] Monad laws

2006-09-07 Thread Albert Lai
Deokhwan Kim <[EMAIL PROTECTED]> writes: > What is the practical meaning of monad laws? > > 1. (return x) >>= f == f x > 2. m >>= return == m > 3. (m >>= f) >>= g == m >> (\x -> f x >>= g) I offer to re-write the laws in do-notation. (Please view with a fixed-width (non-proportional) font

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 exampl

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

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 b

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] Re: Haskell Speed

2005-12-29 Thread Albert Lai
> wc :: String -> (Int, Int, Int) > wc file = ( length (lines file) > , length (words file) > , length file > ) Most people tend to think that imperative programming novices don't even start their obvious solutions from something as inefficient as this. Wel

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 > Hask

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

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 ou

Re: [Haskell-cafe] forall in a lambda abstraction

2005-05-20 Thread Albert Lai
"Scott J." <[EMAIL PROTECTED]> writes: > what's wrong with the code of test1 below. Ghci does complain with > an error message that I don't understand. > test1 = \f ::(forall a. a -> a) -> (f True,f 'a') test1 = \(f :: forall a. a -> a) -> (f True,f 'a') __

[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)

[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) > hPu