#2392: Make Applicative a superclass of Monad
-------------------------------+--------------------------------------------
Reporter: Ashley Yakeley | Owner:
Type: proposal | Status: new
Priority: normal | Component: libraries/base
Version: 6.8.3 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown | Os: Unknown
-------------------------------+--------------------------------------------
Make Applicative (in Control.Applicative) a superclass of Monad (in
Control.Monad). Rename members of Applicative and other functions, to
avoid unnecessary duplication.
{{{
class Functor f => Applicative f where
return :: a -> f a
ap :: f (a -> b) -> f a -> f b
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
liftA2 f a b = ap (fmap f a) b
(>>) :: (Applicative f) => f a -> f b -> f b
(>>) = liftA2 (const id)
-- etc.
}}}
{{{
class Applicative m => Monad m where
(>>=) :: forall a b . m a -> (a -> m b) -> m b
fail :: String -> m a
fail s = error s
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2392>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs