Strictness in UniqFM

Simon Peyton-Jones simonpj at microsoft.com
Tue Feb 5 05:51:29 EST 2008


Ian,

you made this change to UniqFM:

Sat Feb  2 21:35:42 GMT Standard Time 2008  Ian Lynagh <igloo at earth.li>
  * Tweak strictness

    hunk ./compiler/utils/UniqFM.lhs 701
    -  | j ==# i  = mkLeafUFM j (f old new)
    +  | j ==# i  = mkLeafUFM j $! f old new


This gives UniqFM a very odd behaviour: it becomes strict in the *range* (element type) when, but only when, you insert a second element with the same key as an existing one.

It turned out that a change I was making tickled this behaviour, and it took me ages to find.

I could just about imagine that making UniqFM *always* strict in its elements might make sense.  At least it would be consistent.  The one place I know we'd have to fix (by adding an extra Lift) is in the forkM in LoadIface.loadDecl.  But otherwise it'd probably be ok.

But the current situation is inconsistent, and very subtly so. Why did you make this change?  Did you consider making LeafUFM strict instead?  Perhaps you tried that and backed off into an ad-hoc solution?

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/cvs-ghc/attachments/20080205/c23a5a86/attachment.htm


More information about the Cvs-ghc mailing list