list of results monad

G Murali
Fri, 09 Mar 2001 18:32:11


I'm trying to build a monad that will give a list of results.
this is what i want to be able to do

I have

data M a = I [a]

instance Monad M where

return x = I [x]
I (x:xs) >>= f = ??

The type of >>= is m a -> (a -> m b) -> m b
but here the input is [a], now if I apply the input individually on f then i 
can get a [m b] and if i extract at each step then I can get [b] and then if 
i say return ([b]) i get m b.. right ??

Is this how I go about it .. if so can you give me a small code snippet of 
how to do that.

Get Your Private, Free E-mail from MSN Hotmail at