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

Henning Thielemann lemming at henning-thielemann.de
Fri Jul 3 19:08:41 EDT 2009


Ross Paterson schrieb:
> On Tue, Jun 30, 2009 at 01:37:05PM +0200, Henning Thielemann wrote:
>> This sounds like a rather ad-hoc extension of the already complicated  
>> hierarchy of those category classes. Are there particular examples where  
>> the specialisation is needed and where it cannot be done by optimizer  
>> rules?
> 
> Here's one for (<$).  In Data.Sequence, I could define
> 
>   x <$ s = replicate (size s) x
> 
> (using Louis Wasserman's replicate), which would take O(log n) time and
> space, a big improvement over the O(n) version using const and fmap.

Would it be reasonable to let the optimizer replace (x <$ s) by
(replicate (size s) x) via RULES?


More information about the Libraries mailing list