--- On Thu, 10/2/08, Andrew Coppin <[EMAIL PROTECTED]> wrote:
> I'm lost...
> 
> (What does liftM have to do with fmap?)

They're (effectively) the same function.

i.e.

liftM :: (Monad m) => (a -> b) -> m a -> m b
fmap :: (Functor f) => (a -> b) -> f a -> f b

liftM turns a function from a to b into a function from m a to m b;
fmap turns a function from a to b into a function from f a to f b;

If your datatype with a Monad instance also has a Functor instance (which it 
*can* have, you just need to declare the instance), then liftM is equivalent to 
fmap.






      
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to