|
[GHC] #707: foldr/build seems to be broken: msg#00089lang.haskell.glasgow.bugs
#707: foldr/build seems to be broken ---------------------------------------+------------------------------------ Reporter: lennart@xxxxxxxxxxxxxx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 6.4.1 Severity: normal | Keywords: Os: Unknown | Difficulty: Unknown Architecture: Unknown | ---------------------------------------+------------------------------------ Reading the documentation for ghc it says that if a good consumer meets a good producer the intermediate list will disappear. List enumeration is s good producer, and length is a good consumer, so there should be no intermediate list between these. Looking at the example below, it sure looks like a list is generated. {{{ module CG1 where foo :: Int -> Int foo n = length [1..n] -- Compile with -- ghc -v5 -ddump-simpl-stats -ddump-rules -O2 -S CG1.hs -- Output from this compilation {- Glasgow Haskell Compiler, Version 6.4.1, for Haskell 98, compiled by GHC version 6.4 .... ==================== STG syntax: ==================== CG1.foo = \r [n_s1Ah] case n_s1Ah of wild1_s1Ap { GHC.Base.I# y_s1Ak -> case GHC.Enum.eftInt 1 y_s1Ak of sat_s1Am { __DEFAULT -> case GHC.List.$wlen sat_s1Am 0 of ww_s1Ao { __DEFAULT -> GHC.Base.I# [ww_s1Ao]; }; }; }; SRT(CG1.foo): [] .... -} }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/707> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler_______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: the MPTC Dilemma (please solve), Claus Reinke |
|---|---|
| Next by Date: | Re: the MPTC Dilemma (please solve), Claus Reinke |
| Previous by Thread: | Re: the MPTC Dilemma (please solve), Claus Reinke |
| Next by Thread: | Re: [GHC] #707: foldr/build seems to be broken, GHC |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |