[Proposal] Move most of Control.Monad to Control.Applicative

Conal Elliott conal at conal.net
Fri Mar 20 14:51:11 EDT 2009


Also, return, ap, liftM, liftM2, ....  Already discussed?

On Fri, Jan 30, 2009 at 9:03 AM, Thomas Davie <tom.davie at gmail.com> wrote:

> Hi,
>  Most of Control.Monad doesn't actually rely on Monads, but instead
> Applicatives.  Data.Traversable fixes this in a lot of cases, but it would
> be nice to have the 'standard' functions as general as possible.
>
> My quick reading of Control.Monad says these at least should fall victim to
> demotion to applicatives:
>
> mapA :: (Applicative f) => (a -> f b) -> [a] -> f [b]
> mapA_ :: (Applicative f) => (a -> f b) -> [a] -> f ()
> sequence :: (Applicative f) => [f a] -> f [a]
> sequence_ :: (Applicative f) => [f a] -> f ()
>
> filterA :: (Applicative f) => (a -> f Bool) -> [a] -> f [a]
> mapAndUnzipA :: (Applicative f) => (a -> f (b,c)) -> [a] -> f ([b], [c])
> zipWithA :: (Applicative f) => (a -> b -> f c) -> [a] -> [b] -> f [c]
> zipWithA_ :: (Applicative f) => (a -> b -> f c) -> [a] -> [b] -> f ()
> replicateA :: (Applicative f) => Int -> f a -> f [a]
> replicateA_ :: (Applicative f) => Int -> f a -> f ()
>
> when :: (Applicative f) => Bool -> f () -> f ()
> unless :: (Applicative f) => Bool -> f () -> f ()
>
> I may have missed some.
>
> Bob
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-prime/attachments/20090320/d91ea44d/attachment-0001.htm


More information about the Haskell-prime mailing list