[commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Use GHC version for coercion rules (8da46db)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:35:04 UTC 2017


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

On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel
Link       : http://git.haskell.org/packages/containers.git/commitdiff/8da46dbc4598062397c6a6b684f7bae9931f3d80

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

commit 8da46dbc4598062397c6a6b684f7bae9931f3d80
Author: David Feuer <David.Feuer at gmail.com>
Date:   Fri Nov 21 10:14:38 2014 -0500

    Use GHC version for coercion rules
    
    Using the library version didn't make much sense, especially since the
    tests-ghc tests had to switch on compiler version anyway, but also
    because compiling without cabal would prevent the code from being used.
    The conditional fake MIN_VERSION_base definition should probably stay up
    top where I moved it, though, in case someone needs to use it to adjust
    imports or exports in the future--the top seems an inherently better
    place for that.


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

8da46dbc4598062397c6a6b684f7bae9931f3d80
 Data/Map/Base.hs   | 7 +++----
 Data/Map/Strict.hs | 7 +++----
 Data/Sequence.hs   | 7 +++----
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs
index 3911125..e582e16 100644
--- a/Data/Map/Base.hs
+++ b/Data/Map/Base.hs
@@ -294,7 +294,7 @@ import qualified GHC.Exts as GHCExts
 import Text.Read
 import Data.Data
 #endif
-#if MIN_VERSION_base(4,8,0)
+#if __GLASGOW_HASKELL__ >= 709
 import Data.Coerce
 #endif
 
@@ -1668,9 +1668,8 @@ map f (Bin sx kx x l r) = Bin sx kx (f x) (map f l) (map f r)
 "map/map" forall f g xs . map f (map g xs) = map (f . g) xs
  #-}
 #endif
-#if MIN_VERSION_base(4,8,0)
--- Safe coercions were introduced in 4.7.0, but I am not sure if they played
--- well enough with RULES to do what we want.
+#if __GLASGOW_HASKELL__ >= 709
+-- Safe coercions were introduced in 7.8, but did not work well with RULES yet.
 {-# RULES
 "map/coerce" map coerce = coerce
  #-}
diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs
index 6255e91..88f494e 100644
--- a/Data/Map/Strict.hs
+++ b/Data/Map/Strict.hs
@@ -279,7 +279,7 @@ import Data.Utils.StrictFold
 import Data.Utils.StrictPair
 
 import Data.Bits (shiftL, shiftR)
-#if MIN_VERSION_base(4,8,0)
+#if __GLASGOW_HASKELL__ >= 709
 import Data.Coerce
 #endif
 
@@ -941,9 +941,8 @@ map f (Bin sx kx x l r) = let x' = f x in x' `seq` Bin sx kx x' (map f l) (map f
 "map/map" forall f g xs . map f (map g xs) = map (f . g) xs
  #-}
 #endif
-#if MIN_VERSION_base(4,8,0)
--- Safe coercions were introduced in 4.7.0, but I am not sure if they played
--- well enough with RULES to do what we want.
+#if __GLASGOW_HASKELL__ >= 709
+-- Safe coercions were introduced in 7.8, but did not work well with RULES yet.
 {-# RULES
 "mapSeq/coerce" map coerce = coerce
  #-}
diff --git a/Data/Sequence.hs b/Data/Sequence.hs
index 331ac30..4799056 100644
--- a/Data/Sequence.hs
+++ b/Data/Sequence.hs
@@ -165,7 +165,7 @@ import Text.Read (Lexeme(Ident), lexP, parens, prec,
     readPrec, readListPrec, readListPrecDefault)
 import Data.Data
 #endif
-#if MIN_VERSION_base(4,8,0)
+#if __GLASGOW_HASKELL__ >= 709
 import Data.Coerce
 #endif
 
@@ -197,9 +197,8 @@ fmapSeq f (Seq xs) = Seq (fmap (fmap f) xs)
 "fmapSeq/fmapSeq" forall f g xs . fmapSeq f (fmapSeq g xs) = fmapSeq (f . g) xs
  #-}
 #endif
-#if MIN_VERSION_base(4,8,0)
--- Safe coercions were introduced in 4.7.0, but I am not sure if they played
--- well enough with RULES to do what we want.
+#if __GLASGOW_HASKELL__ >= 709
+-- Safe coercions were introduced in 7.8, but did not work well with RULES yet.
 {-# RULES
 "fmapSeq/coerce" fmapSeq coerce = coerce
  #-}



More information about the ghc-commits mailing list