[Haskell-cafe] Lists and monads

2010-07-26 Thread Kevin Jardine
As a Haskell neophyte, one of the things I find confusing is the way that the usual list functions (map, fold, ++, etc.) often cannot be used directly with monadic lists (m [a] or [m a]) but seem to require special purpose functions like ap, mapM etc. I get the idea of separating pure and impure

Re: [Haskell-cafe] Lists and monads

2010-07-26 Thread Vo Minh Thu
2010/7/26 Kevin Jardine kevinjard...@gmail.com: As a Haskell neophyte, one of the things I find confusing is the way that the usual list functions (map, fold, ++, etc.) often cannot be used directly with monadic lists (m [a] or [m a]) but seem to require special purpose functions like ap, mapM

Re: [Haskell-cafe] Lists and monads

2010-07-26 Thread Serguey Zefirov
2010/7/26 Kevin Jardine kevinjard...@gmail.com: I suspect that things are not quite as difficult as they appear, however, but cannot find any tutorials on monadic list manipulation. I'd suggest that you get as many pure values as possible from impure world, apply to them easy to use pure

Re: [Haskell-cafe] Lists and monads

2010-07-26 Thread John Lato
From: Kevin Jardine kevinjard...@gmail.com As a Haskell neophyte, one of the things I find confusing is the way that the usual list functions (map, fold, ++, etc.) often cannot be used directly with monadic lists (m [a] or [m a]) but seem to require special purpose functions like ap, mapM

Re: [Haskell-cafe] Lists vs. Monads

2005-07-16 Thread Jonathan Cast
Greg Buchholz [EMAIL PROTECTED] wrote: Here's a question for the Haskell community that I've been wrestling with lately. When we say lists are monads what does that mean? I can see one of two things. First the slightly superficial... A.) Lists can be made members of the

[Haskell-cafe] Lists vs. Monads

2005-07-15 Thread Greg Buchholz
Here's a question for the Haskell community that I've been wrestling with lately. When we say lists are monads what does that mean? I can see one of two things. First the slightly superficial... A.) Lists can be made members of the Monads class, and you can define a couple of

Re: [Haskell-cafe] Lists vs. Monads

2005-07-15 Thread Cale Gibbard
Interpretation A is correct. The type (constructor) of Lists gives a monad together with return x = [x] and x = f = concatMap f x. Interpretation B doesn't really work, because the monad interface does not give one the ability to write head or tail. You basically have return (which gets you from