[commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Add ap/fmap2 rule for sequences (53fd934)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:47:53 UTC 2017


Repository : ssh://git@git.haskell.org/containers

On branches: cleaned_bugfix394,master,revert-408-bugfix_394
Link       : http://git.haskell.org/packages/containers.git/commitdiff/53fd9342fd8a7ab5d00deb2919593fc9887f44d7

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

commit 53fd9342fd8a7ab5d00deb2919593fc9887f44d7
Author: David Feuer <David.Feuer at gmail.com>
Date:   Wed Feb 8 14:47:26 2017 -0500

    Add ap/fmap2 rule for sequences


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

53fd9342fd8a7ab5d00deb2919593fc9887f44d7
 Data/Sequence/Internal.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs
index 7cc5048..71279a8 100644
--- a/Data/Sequence/Internal.hs
+++ b/Data/Sequence/Internal.hs
@@ -458,7 +458,9 @@ apSeq fs xs@(Seq xsFT) = case viewl fs of
 {-# NOINLINE [1] apSeq #-}
 
 {-# RULES
-"ap/fmap" forall f xs ys . apSeq (fmapSeq f xs) ys = liftA2Seq f xs ys
+"ap/fmap1" forall f xs ys . apSeq (fmapSeq f xs) ys = liftA2Seq f xs ys
+"ap/fmap2" forall f gs xs . apSeq gs (fmapSeq f xs) =
+                              liftA2Seq (\g x -> g (f x)) gs xs
 "fmap/ap" forall f gs xs . fmapSeq f (gs `apSeq` xs) =
                              liftA2Seq (\g x -> f (g x)) gs xs
 "fmap/liftA2" forall f g m n . fmapSeq f (liftA2Seq g m n) =



More information about the ghc-commits mailing list