1{-# LANGUAGE BangPatterns, Rank2Types, OverloadedStrings,
2    RecordWildCards, MagicHash, UnboxedTuples #-}
3
4module Data.Attoparsec.Internal.Fhthagn
5    (
6      inlinePerformIO
7    ) where
8
9import GHC.Exts (realWorld#)
10import GHC.IO (IO(IO))
11
12-- | Just like unsafePerformIO, but we inline it. Big performance gains as
13-- it exposes lots of things to further inlining. /Very unsafe/. In
14-- particular, you should do no memory allocation inside an
15-- 'inlinePerformIO' block. On Hugs this is just @unsafePerformIO@.
16inlinePerformIO :: IO a -> a
17inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r
18{-# INLINE inlinePerformIO #-}
19