Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/49ca2a37bef18aa57235ff1dbbf1cc0434979b1e

>---------------------------------------------------------------

commit 49ca2a37bef18aa57235ff1dbbf1cc0434979b1e
Author: Twan van Laarhoven <twa...@gmail.com>
Date:   Fri Nov 23 15:03:45 2012 +0100

    Changed deriving of Functor, Foldable, Traversable to fix #7436. Added 
foldMap to derived Foldable instance.
    
    The derived instances will no longer eta-expand the function. I.e. instead 
of
        fmap f (Foo a) = Foo (fmap (\x -> f x) a)
    we now derive
        fmap f (Foo a) = Foo (fmap f a)
    
    Some superflous lambdas are generated as a result. For example
        data X a = X (a,a)
        fmap f (X x) = (\y -> case y of (a,b) -> (f a, f b)) x
    The optimizer should be able to simplify this code, as it is just beta 
reduction.
    
    The derived Foldable instance now includes foldMap in addition to foldr.

 compiler/prelude/PrelNames.lhs    |    9 ++-
 compiler/typecheck/TcGenDeriv.lhs |  178 ++++++++++++++++++++++---------------
 2 files changed, 114 insertions(+), 73 deletions(-)


Diff suppressed because of size. To see it, use:

    git show 49ca2a37bef18aa57235ff1dbbf1cc0434979b1e

_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to