[Haskell-cafe] Call for discussion: OverloadedLists extension

Aleksey Khudyakov alexey.skladnoy at gmail.com
Tue Sep 25 10:49:53 CEST 2012

> That's part of a problem. There are really two aspects to it. Firstly, a
> naive list-based implementation would be a loop. But when I write ([x,y]
> :: Vector Double) somewhere in an inner loop in my program, I *really*
> don't want a loop with two iterations at runtime - I want just an
> allocation and two writes. I suppose this could be solved by doing
> something like this:
Some time ago I played with function fromList and rewrite rules.
For statically known lists it's possible to rewrite

fromList [a,b,c] → cons a $ cons b $ cons c $ empty

Latter is compiled down to single allocation and three writes.

More information about the Haskell-Cafe mailing list