[Haskell-cafe] Daunting heap profile when using (<>)

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Nov 14 16:32:19 UTC 2015


On Sat, Nov 14, 2015 at 05:17:41PM +0100, martin wrote:
> with lots of trial and error I believe I finally put the exclamation marks
> in the right spots, but I still don't understand.

It's pretty reasonable not to understand!  Understanding exactly what's
going with strictness annotations can be very mind-bending.

> I had previously put the marks inside the tuples as in (!log1', !lgr1')
> but that didn't help.  Can someone explain the difference between (!log1',
> !lgr1') and !(log1', lgr1').  I thought the former enforces more
> strictness than the later, but I must be missing something.

Those two are completely independent.

let !(a, b) = ... forces the tuple constructor immedately, but not the
contents

let (!a, !b) = ... doesn't force the tuple constructor, but *when it is
forced* a and b will be forced at the same time.

Neither is more or less strict than the other.

Tom


More information about the Haskell-Cafe mailing list