#4201: Improve eta reduction ---------------------------------+------------------------------------------ Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 6.12.3 Keywords: | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown ---------------------------------+------------------------------------------ Consider {{{ -- bar :: Int -> Int -- g :: Moo ~ Int f :: (Moo -> Int) -> Char foo f = f (\ x -> bar (x `cast` a)) }}} This will allocate a closure for `(\ x -> bar (x `cast` a))` before calling `f`. But really it should eta-reduce the lambda to {{{ foo f = f (bar `cast` (sym g -> Int)) -- (sym g -> Int) :: (Int -> Int) ~ (Moo -> Int) }}} Result: no allocation before calling `f`.
Thanks to Louis for suggesting this http://www.haskell.org/pipermail /glasgow-haskell-users/2010-July/018982.html -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4201> 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