Skip to content

Commit ddf12fd

Browse files
committed
Merge pull request #75 from treeowl/coerce-version
Use GHC version for coercion rules
2 parents dde7a53 + 8da46db commit ddf12fd

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

Data/Map/Base.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ import qualified GHC.Exts as GHCExts
294294
import Text.Read
295295
import Data.Data
296296
#endif
297-
#if MIN_VERSION_base(4,8,0)
297+
#if __GLASGOW_HASKELL__ >= 709
298298
import Data.Coerce
299299
#endif
300300

@@ -1668,9 +1668,8 @@ map f (Bin sx kx x l r) = Bin sx kx (f x) (map f l) (map f r)
16681668
"map/map" forall f g xs . map f (map g xs) = map (f . g) xs
16691669
#-}
16701670
#endif
1671-
#if MIN_VERSION_base(4,8,0)
1672-
-- Safe coercions were introduced in 4.7.0, but I am not sure if they played
1673-
-- well enough with RULES to do what we want.
1671+
#if __GLASGOW_HASKELL__ >= 709
1672+
-- Safe coercions were introduced in 7.8, but did not work well with RULES yet.
16741673
{-# RULES
16751674
"map/coerce" map coerce = coerce
16761675
#-}

Data/Map/Strict.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ import Data.Utils.StrictFold
279279
import Data.Utils.StrictPair
280280

281281
import Data.Bits (shiftL, shiftR)
282-
#if MIN_VERSION_base(4,8,0)
282+
#if __GLASGOW_HASKELL__ >= 709
283283
import Data.Coerce
284284
#endif
285285

@@ -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
941941
"map/map" forall f g xs . map f (map g xs) = map (f . g) xs
942942
#-}
943943
#endif
944-
#if MIN_VERSION_base(4,8,0)
945-
-- Safe coercions were introduced in 4.7.0, but I am not sure if they played
946-
-- well enough with RULES to do what we want.
944+
#if __GLASGOW_HASKELL__ >= 709
945+
-- Safe coercions were introduced in 7.8, but did not work well with RULES yet.
947946
{-# RULES
948947
"mapSeq/coerce" map coerce = coerce
949948
#-}

Data/Sequence.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ import Text.Read (Lexeme(Ident), lexP, parens, prec,
165165
readPrec, readListPrec, readListPrecDefault)
166166
import Data.Data
167167
#endif
168-
#if MIN_VERSION_base(4,8,0)
168+
#if __GLASGOW_HASKELL__ >= 709
169169
import Data.Coerce
170170
#endif
171171

@@ -197,9 +197,8 @@ fmapSeq f (Seq xs) = Seq (fmap (fmap f) xs)
197197
"fmapSeq/fmapSeq" forall f g xs . fmapSeq f (fmapSeq g xs) = fmapSeq (f . g) xs
198198
#-}
199199
#endif
200-
#if MIN_VERSION_base(4,8,0)
201-
-- Safe coercions were introduced in 4.7.0, but I am not sure if they played
202-
-- well enough with RULES to do what we want.
200+
#if __GLASGOW_HASKELL__ >= 709
201+
-- Safe coercions were introduced in 7.8, but did not work well with RULES yet.
203202
{-# RULES
204203
"fmapSeq/coerce" fmapSeq coerce = coerce
205204
#-}

0 commit comments

Comments
 (0)