[Haskell-cafe] How to write fast for loops

Daniel Fischer daniel.is.fischer at googlemail.com
Sun Apr 27 12:21:34 UTC 2014

On Sunday 27 April 2014, 08:47:32, Tom Ellis wrote:
> On Sun, Apr 27, 2014 at 03:32:12AM +0200, Daniel Fischer wrote:
> > The problem is that you use the same list multiple times, and GHC thinks
> > "hey, let me re-use that", so it gets floated to the top-level
> If this is the case, does -fno-full-laziness help?

Yes and no. It prevents the list from being floated to the top-level, but the 
overall code you get is slower than with the shared list.

So it works as far as preventing unwanted sharing is concerned, but it 
inhibits optimisations at other places.

More information about the Haskell-Cafe mailing list