Ashley Yakeley wrote:
For example:
class Functor f => Applicative f where
return :: a -> f a
ap :: f (a -> b) -> f a -> f b
(>>) :: f a -> f b -> f b
(>>) = liftA2 (const id)
for backwards compatibility of everyone who *uses* Applicative, (and
arguably it is a less ugly notation,) :
(<*>) = ap
(and pure = return)
I'm not sure, is the word "ap" even as well known as "<*>" right now? I
wonder which one we'd prefer to use in Applicative?
class Applicative m => Monad m where
(>>=) :: m a -> (a -> m b) -> m b
fail :: String -> m a
fail s = error s
I want to add to this Applicative=>Monad class:
join :: m (m a) -> m a
join mm = mm >>= id
m >>= f = join (fmap f m)
What do others think about that?
(P.S. And I guess this hierarchy change is quite independent of the
difficult task of removing "fail" from Monad, so I won't discuss that
here/now)
-Isaac
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime