Proposal: add liftA4 and liftA5 to match liftM4 and liftM5

Aleksey Khudyakov alexey.skladnoy at gmail.com
Sat Nov 8 12:52:37 UTC 2014


On 8 November 2014 13:42, Andreas Abel <abela at chalmers.se> wrote:
> I am a bit alert about this discussion because it seems that we have quite
> different ideas about how the AMP implementation should affect the base
> libraries.
>
> 1. Where can we see and discuss the proposed changes?
>
> Not on
> https://www.haskell.org/haskellwiki/Functor-Applicative-Monad_Proposal
>
> Not on https://ghc.haskell.org/trac/ghc/ticket/9586
>
> 2. Imho, the reasonable thing is to
>
>   rewrite all of F/A/M base functions such that they use the minimal F/A/M
> constraints.
>
> This of course includes
>
>   liftM  :: (Functor m) => (a -> b) -> m a -> m b
>   liftM2 :: (Applicative m) => (a -> b -> c) -> m a -> m b -> m c
>
I don't think it's wise to rewrite _all_ functions. In particular liftM and ap
shoudl stay as they are. Those are implementations of fmap and <*> using
monadic bind and thus useful for writing instances like:

> instance Functor T where
>   fmap = liftM
> instance Applicative T where
>   pure = return; (<*>) = ap
> instance Monad T where ...

Changing ap will break a lot of code.


More information about the Libraries mailing list