On Tue, May 28, 2013 at 04:42:35PM +0200, Johannes Gerer wrote:
> By the same argument, could'nt I say, that any type class (call it
> AnyClass) can do everything a Monad can:
>
> instance AnyClass m => Monad (Cokleilsi m ())
That doesn't say that AnyClass can do anything a Monad can. "AnyClass m =>
Monad m" would say that, but that's not what you've got.
What you've got is that "Cokleisli m ()" i.e. "(->) m ()" is a Monad for any
"m". This is not surprising. The implementation is the same as the Reader
monad.
Check out the instance implementations for "Monad (Reader r)" and "Monad
(CoKleisli w a)". You will find they are the same.
http://hackage.haskell.org/packages/archive/mtl/1.1.0.2/doc/html/src/Control-Monad-Reader.html#Reader
http://hackage.haskell.org/packages/archive/comonad/3.0.0.2/doc/html/src/Control-Comonad.html#Cokleisli
Tom
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe