[Haskell-cafe] better way to do this?
Felipe Lessa
felipe.lessa at gmail.com
Tue Oct 6 07:00:35 EDT 2009
On Mon, Oct 05, 2009 at 07:24:00AM -0700, Michael Mossey wrote:
> If I understand correctly, this works because IO is an instance of
> Applicative, correct?
>
> I wonder if any of the random monads are instances of Applicative.
If they aren't then that's a bug in the library :). Every monad
can be made an instance of Applicative; given any monad M,
instance Functor M where
fmap = liftM -- from Control.Monad
instance Applicative M where
pure = return
(<*>) = ap -- from Control.Applicative
--
Felipe.
More information about the Haskell-Cafe
mailing list