Thu May 1 16:01:52 PDT 2008 Don Stewart <[EMAIL PROTECTED]>
* Inline [EMAIL PROTECTED], enables rotate to be constant folded
All other Bits instances seem to inline well enough on their own
to enable constant folding, e.g.
sumU . mapU (`shift` 3) . replicateU 10000000 $ (7 :: Int)
goes to:
Main.$wfold =
\ (ww_sOb :: Int#) (ww1_sOf :: Int#) ->
case ww1_sOf of wild_XM {
__DEFAULT -> Main.$wfold (+# ww_sOb 56) (+# wild_XM 1);
10000000 -> ww_sOb
}
With this patch, rotate gets inlined and folded too,
sumU . mapU (`rotate` 3) . replicateU 10000000 $ (7 :: Int)
to:
Main.$wfold =
\ (ww_sO7 :: Int#) (ww1_sOb :: Int#) ->
case ww1_sOb of wild_XM {
__DEFAULT -> Main.$wfold (+# ww_sO7 56) (+# wild_XM 1);
10000000 -> ww_sO7
Whereas it was left as a call to $wrotate before.
M ./Data/Bits.hs -1 +8
View patch online:
http://darcs.haskell.org/packages/base/_darcs/patches/20080501230152-cba2c-adb8ea1981dbc6427b2d85b054533517ffc3b4c3.gz
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries