#2353: GHC inliner doesn't
---------------------------------+------------------------------------------
    Reporter:  guest             |        Owner:                  
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:  6.12 branch     
   Component:  Compiler          |      Version:  6.9             
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Comment (by ross):

 I think I've just tripped over this one.  In Data.Foldable, there is
 {{{
 toList :: Foldable t => t a -> [a]
 toList t = build (\ c n -> Data.Foldable.foldr c n t)
 }}}
 so I would expect
 {{{
 f :: Foldable t => t a -> [a]
 f xs = last (map (:[]) (toList xs))
 }}}
 (only using last to simplify the example) to deforest to the equivalent of
 {{{
 f xs = last (Data.Foldable.foldr (\ x -> [x]:) [] xs)
 }}}
 but it doesn't, because toList isn't inlined until too late, even if I
 give it an INLINE pragma.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2353#comment:13>
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

Reply via email to