Skip to content

Commit 3b91932

Browse files
authored
Merge pull request #159 from treeowl/runST
Remove dangerous ST hack for recent base library
2 parents c0bb73e + 55ae9b0 commit 3b91932

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Data/HashMap/Unsafe.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
{-# LANGUAGE CPP #-}
2+
3+
#if !MIN_VERSION_base(4,9,0)
14
{-# LANGUAGE MagicHash, Rank2Types, UnboxedTuples #-}
5+
#endif
26

37
-- | This module exports a workaround for this bug:
48
--
@@ -12,6 +16,12 @@ module Data.HashMap.Unsafe
1216
( runST
1317
) where
1418

19+
#if MIN_VERSION_base(4,9,0)
20+
-- The GHC issue was fixed in GHC 8.0/base 4.9
21+
import Control.Monad.ST
22+
23+
#else
24+
1525
import GHC.Base (realWorld#)
1626
import qualified GHC.ST as ST
1727

@@ -26,3 +36,4 @@ runSTRep :: (forall s. ST.STRep s a) -> a
2636
runSTRep st_rep = case st_rep realWorld# of
2737
(# _, r #) -> r
2838
{-# INLINE [0] runSTRep #-}
39+
#endif

0 commit comments

Comments
 (0)