last uses too much space with optimizations disabled
I know we don't worry too much about performance when optimizations are disabled, but last [1..n]
using O(n) space when the naive definition would run in O(1) space is a bit too much I think.
Can we split out the new definition to a separate function and use a rule to rewrite last
to that function when optimizations are enabled? I'm not expert enough on the use of rules and inlining phases etc. to write the patch myself, but I think it should be simple.
This showed up when investigating #10247 (closed)
Edited by Simon Peyton Jones