[Haskell-cafe] operating on nested monads

Marco Righele marco_righele at yahoo.it
Fri Mar 26 16:21:08 EST 2004

Hello everyone,

I have some operations that have to be done in sequence, with
each one having the result of the previous as input.
They can fail, so they have signature 
a -> Maybe b
Checking for error can be quite tedious so I use monadic operations:

f :: a -> Maybe b
do	y <- foo x
	z <- boo y
	moo z

The problems arise when I try to do the same thing within the IO Monad,
i.e. the functions have signature
a->IO (Maybe b)

How can I achieve the same effect (if it is ever possible)?
I feel like it should be something almost trivial, but I really can't get it.


More information about the Haskell-Cafe mailing list