<commit_before>{-# LANGUAGE CPP, MagicHash, Rank2Types, UnboxedTuples #-}

-- | This module exports a workaround for this bug:
--
--    http://hackage.haskell.org/trac/ghc/ticket/5916
--
-- Please read the comments in ghc/libraries/base/GHC/ST.lhs to
-- understand what's going on here.
--
-- Code that uses this module should be compiled with -fno-full-laziness
module Data.HashMap.Unsafe
    ( runST
    , noDuplicateST
    ) where

import GHC.Base (realWorld#)
import qualified GHC.ST as ST
import qualified GHC.Exts as Exts
import Unsafe.Coerce

#if __GLASGOW_HASKELL__ < 801

-- | Return the value computed by a state transformer computation.
-- The @forall@ ensures that the internal state used by the 'ST'
-- computation is inaccessible to the rest of the program.
runST :: (forall s. ST.ST s a) -> a
runST st = runSTRep (case st of { ST.ST st_rep -> st_rep })
{-# INLINE runST #-}

runSTRep :: (forall s. ST.STRep s a) -> a
runSTRep st_rep = case st_rep realWorld# of
                        (# _, r #) -> r
{-# INLINE [0] runSTRep #-}

#else

runST :: (forall s. ST.ST s a) -> a
runST = ST.runST

#endif

noDuplicateST :: ST.ST s ()
noDuplicateST = ST.ST $ \s -> (# unsafeCoerce Exts.noDuplicate# s, () #)<commit_msg>Fix unused imports warnings<commit_after>{-# LANGUAGE CPP, MagicHash, Rank2Types, UnboxedTuples #-}

-- | This module exports a workaround for this bug:
--
--    http://hackage.haskell.org/trac/ghc/ticket/5916
--
-- Please read the comments in ghc/libraries/base/GHC/ST.lhs to
-- understand what's going on here.
--
-- Code that uses this module should be compiled with -fno-full-laziness
module Data.HashMap.Unsafe
    ( runST
    , noDuplicateST
    ) where

#if __GLASGOW_HASKELL__ < 801
import GHC.Base (realWorld#)
#endif
import qualified GHC.ST as ST
import qualified GHC.Exts as Exts
import Unsafe.Coerce

#if __GLASGOW_HASKELL__ < 801

-- | Return the value computed by a state transformer computation.
-- The @forall@ ensures that the internal state used by the 'ST'
-- computation is inaccessible to the rest of the program.
runST :: (forall s. ST.ST s a) -> a
runST st = runSTRep (case st of { ST.ST st_rep -> st_rep })
{-# INLINE runST #-}

runSTRep :: (forall s. ST.STRep s a) -> a
runSTRep st_rep = case st_rep realWorld# of
                        (# _, r #) -> r
{-# INLINE [0] runSTRep #-}

#else

runST :: (forall s. ST.ST s a) -> a
runST = ST.runST

#endif

noDuplicateST :: ST.ST s ()
noDuplicateST = ST.ST $ \s -> (# unsafeCoerce Exts.noDuplicate# s, () #)
{'fraction_non_alphanumeric': 0.1250499400719137, 'fraction_numerical': 0.008389932081502197, 'mean_word_length': 2.993620414673046, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3672338', 'n_tokens_mistral': 923, 'n_tokens_neox': 882, 'n_words': 297}