
3 Jul
2009
3 Jul
'09
7:08 p.m.
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?