[commit: ghc] master: Add a comment to the mapFB rules (665cefe)
git at git.haskell.org
git at git.haskell.org
Thu Mar 9 15:14:02 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/665cefe80d112ed2e4fb9617d277a1466e83f9bd/ghc
>---------------------------------------------------------------
commit 665cefe80d112ed2e4fb9617d277a1466e83f9bd
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Mar 9 16:13:08 2017 +0100
Add a comment to the mapFB rules
to amend 2fa44217c1d9722227297eefb0d6c6aed7e128ca.
>---------------------------------------------------------------
665cefe80d112ed2e4fb9617d277a1466e83f9bd
libraries/base/GHC/Base.hs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 6f9d454..a678c22 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -964,10 +964,12 @@ mapFB c f = \x ys -> c (f x) ys
-- (along with build's unfolding) else we'd get an infinite loop
-- in the rules. Hence the activation control below.
--
--- The "mapFB" rule optimises compositions of map.
---
-- This same pattern is followed by many other functions:
-- e.g. append, filter, iterate, repeat, etc.
+--
+-- The "mapFB" rule optimises compositions of map and
+-- the "mapFB/id" rule get rids of 'map id' calls.
+-- (Any similarity to the Functor laws for [] is expected.)
{-# RULES
"map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs)
More information about the ghc-commits
mailing list