Hi

In future, you are probably best off addressing these general

questions to the haskell-cafe@ mailing list.

> f a = let m = id a in do return m

We can simplify this to:

f a = let m = id a in do return m

f a = let m = a in do return m

f a = do return a

f a = return a

This shows why f has the same type as return.

> f' a = do m <- id a

> return m

f' a = id a >>= \m -> return m

f' a = a >>= \m -> return m

You basically return a, but have sent it through >>= which means it

must be monadic.

> g a = let m =[a,a] in do return m

g a = return [a,a]

> g' a = do m <- [a,a]

> return m

This is the tricky one. Here your use of m <- [a,a] has bound the

Monad in question to be the list Monad, hence you get a result in

terms of lists, not monads. do notation applies to any monad,

including list.

Thanks

Neil

_______________________________________________

Hugs-Users mailing list

[hidden email]
http://www.haskell.org/mailman/listinfo/hugs-users