#3138: Returning a known constructor: GHC generates terrible code for cmonad
-----------------------------------------+----------------------------------
    Reporter:  simonpj                   |        Owner:                  
        Type:  run-time performance bug  |       Status:  new             
    Priority:  normal                    |    Milestone:  6.12 branch     
   Component:  Compiler                  |      Version:  6.10.1          
    Severity:  normal                    |   Resolution:                  
    Keywords:                            |   Difficulty:  Unknown         
    Testcase:                            |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple          |  
-----------------------------------------+----------------------------------
Comment (by augustss):

 A first thing to look at is the fact that there's still dictionaries in
 the code.
 There's no unresolved overloading in Inf.hs, so all dictionaries should be
 gone.

 To avoid the disturbing recursive while function, try this code instead:
 {{{
 inf = runE $ do
     s <- auto 0
     i <- auto 0
     i =: 1
     if1 ((i :: E m Double) <= 1e3) $ do
         s += 1/i
         i += 1
     retrn s
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3138#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to