
28 Sep
2012
28 Sep
'12
2:48 p.m.
On 12-09-26 08:07 PM, wren ng thornton wrote:
On 9/25/12 1:57 PM, Sjoerd Visscher wrote:
Maybe we could make a literal [a,b,c] turn into unpack [a,b,c]# where [a,b,c]# is a statically-allocated vector?
I'm kinda surprised this isn't already being done. Just doing this seems like it'd be a good undertaking, regardless of whether we get overloaded list literals. Just storing the literal as a C-like array and inflating it to a list/array/vector at runtime seems like it should be a big win for code that uses a lot of literals.
Why? I'm surprised that this is an issue at all. If list literals you are talking about are constant, wouldn't GHC apply constant folding and construct the list only the first time it's needed?