
2009/2/18 Max Bolingbroke
Yes - GHC wants to share the work of (maxBound-x)`div`10 between several partial applications of "digit". This is usually a good idea, but in this case it sucks because it's resulted in a massively increased arity. IMHO GHC should fix this by: * Marking divInt# INLINE in the base library. This would result in your code would just containing uses of quotInt# * Making some operations cheap even if they may fail (PrimOp.primpOpIsCheap should change). Though this might mean that we turn non-terminating programs into terminating ones (such operations get pushed inside lambdas) but this is consistent with our treatment of lambdas generally.
Just to let you know - I've filed a bug (#3034 http://hackage.haskell.org/trac/ghc/ticket/3034) about this issue. I've taken the liberty of adding you to the CC list so you can keep track of the problem. Cheers, Max