--8<---------------cut here---------------start------------->8---
import Control.Applicative as A (Applicative(..))
data Maybe' a = Nothing' | Just' a
instance Functor Maybe' where
fmap f (Just' v) = Just' (f v)
fmap _ Nothing' = Nothing'
instance A.Applicative Maybe' where
pure = Just'
f1 <*> f2 = f1 >>= \v1 -> f2 >>= (pure . v1)
instance Monad Maybe' where
Nothing' >>= _ = Nothing'
Just' x >>= f = f x
return = pure -- "deprecated" since GHC 7.10
--8<---------------cut here---------------end--------------->8---
-- hvr
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime