I started my Grand Haskell Crusade (GHC :) ) and I am a bit confused with monads and IO functions. Could anyone explain simply what is the difference between those
My understanding is that doing
return [1,2] when in the List monad is the same as doing
func :: Maybe (Maybe Int)
func = return $ Just 1
which is why you end up with wrapped lists, as [] are just syntactic sugar right?
When really he wanted to do
func :: Maybe Int
func = return 5
or
func = Just 5
Its a bit easier to see whats going on with the Maybe monad I think.
So when you do
return [1,2]
You are doing the same as
[ [1,2] ]