
15 Jan
2015
15 Jan
'15
4:03 p.m.
Hello, A list ([]) is also a monad, and a String is defined as a list of characters ([Char]). So in your example, it's as if you were trying to use (>>=) operator on two different monads ([] and IO), which is impossible. To make a pure value a monadic value, you need to use return: g = readLn >>= (\a -> return (f a)) which is equivalent to composing f with return: g = readLn >>= return.f Regards, Marcin