Re: [Haskell-cafe] Is ListT a valid MonadPlus?

2012-02-09 Thread oleg
First of all, ListT is not a monad transformer, since it breaks the law of associativity of bind: *Control.Monad.List let one = (lift $ putStrLn 1) :: ListT IO () *Control.Monad.List let two = (lift $ putStrLn 2) :: ListT IO () *Control.Monad.List let choice = return 1 `mplus` return 2 :: ListT

[Haskell-cafe] Is ListT a valid MonadPlus?

2012-02-08 Thread Richard Wallace
It appears to me that the MonadPlus instance for ListT breaks the following MonadPlus law m mzero = mzero I've tried with every implementation of ListT I could find - the one in mtl, transformers, List, even ListT done right and it's alternative. They all seem to violate the above law.