#3404: Strictness analysis bug with Double
------------------------------+---------------------------------------------
Reporter: lpsmith | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.4
Severity: normal | Resolution:
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
------------------------------+---------------------------------------------
Comment (by dons):
sum is defined as foldl (+). For some atomic types (Int, Integer) we
generate specialized versions, but not for Double currently.
This is an example of the broader syndrome of irregular specializations in
the base library. Other tickets:
#2251
#2270
#2271
Notably it is solved by #915 or by doing regular RULES/SPECIALIZE for all
atomic numeric types, for base functions on Num a => a ...
Another solution is to use uvector (stream fusion again).
{{{
import Data.Array.Vector
main = print (sumU (enumFromToFracU 1 1e7) :: Double)
$wfold :: Double# -> Double# -> Double#
$wfold =
\ (ww_s15b :: Double#) (ww1_s15f :: Double#) ->
case >## ww1_s15f 1.00000005e7 of wild_aWD {
False ->
$wfold
(+## ww_s15b ww1_s15f) (+## ww1_s15f 1.0);
True -> ww_s15b
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3404#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs