proposal #3335: make some Applicative functions into methods, and split off Data.Functor

Ross Paterson ross at soi.city.ac.uk
Wed Aug 19 11:40:20 EDT 2009


On Mon, Jun 29, 2009 at 01:45:45PM +0100, Ross Paterson wrote:
> The proposal is that the following functions
>   
>     (<$) :: Functor f => a -> f b -> f a 
>     (*>) :: Applicative f => f a -> f b -> f b 
>     (<*) :: Applicative f => f a -> f b -> f a 
>     some :: Alternative f => f a -> f [a]
>     many :: Alternative f => f a -> f [a]
>   
> are moved into the corresponding classes, with the existing implementations
> as default definitions.

Henning asked for concrete examples (i.e. code) where this would give
a substantial performance win while still defining the same function,
including termination properties.  (But it seems reasonable not to rely
on RULES to improve the asymptotic complexity.)

I gave an example for (<$).  Does anyone have concrete examples for
the others?


More information about the Libraries mailing list