[Haskell-cafe] Merry monad mixup?

2011-01-28 Thread michael rice
The first and third work, but not the second. Why? Michael == f :: String - IO () f s = do putStrLn s {- g :: [String] - IO () g l = do s - l putStrLn s -} {- h :: [Int] - [Int] h l = do i - l return (i+1) -} == serialize2.hs:29:9:     Couldn't

Re: [Haskell-cafe] Merry monad mixup?

2011-01-28 Thread Chris Smith
On Fri, 2011-01-28 at 11:20 -0800, michael rice wrote: The first and third work, but not the second. Why? When you use a do block, it can be the syntactic sugar for whatever monad you like; but you do have to make a choice. Your first example had a do block for the IO monad. Your third example

Re: [Haskell-cafe] Merry monad mixup?

2011-01-28 Thread Daniel Peebles
Beware of ListT. It only works if your internal monad is commutative, which IO is not. (Maybe would work, for example) On Fri, Jan 28, 2011 at 2:41 PM, Chris Smith cdsm...@gmail.com wrote: On Fri, 2011-01-28 at 11:20 -0800, michael rice wrote: The first and third work, but not the second.

Re: [Haskell-cafe] Merry monad mixup?

2011-01-28 Thread Daniel Peebles
And by works, I mean, ListT is is a monad only if the internal monad is commutative. On Fri, Jan 28, 2011 at 2:46 PM, Daniel Peebles pumpkin...@gmail.comwrote: Beware of ListT. It only works if your internal monad is commutative, which IO is not. (Maybe would work, for example) On Fri, Jan

Re: [Haskell-cafe] Merry monad mixup?

2011-01-28 Thread michael rice
So, my suspicions are confirmed. Thanks, all. Michael --- On Fri, 1/28/11, Daniel Peebles pumpkin...@gmail.com wrote: From: Daniel Peebles pumpkin...@gmail.com Subject: Re: [Haskell-cafe] Merry monad mixup? To: Chris Smith cdsm...@gmail.com Cc: michael rice nowg...@yahoo.com, haskell cafe