@@ -1,5 +1,4 @@
1−{-# LANGUAGE BangPatterns, Rank2Types, OverloadedStrings,
2− RecordWildCards, MagicHash, UnboxedTuples #-}
1+{-# LANGUAGE BangPatterns, OverloadedStrings, RecordWildCards #-}
32-- |
43-- Module : Data.Attoparsec.ByteString.Internal
54-- Copyright : Bryan O'Sullivan 2007-2014
@@ -69,6 +68,7 @@ module Data.Attoparsec.ByteString.Internal
6968import Control.Applicative ((<|>), (<$>))
7069import Control.Monad (when)
7170import Data.Attoparsec.ByteString.FastSet (charClass, memberWord8)
71+import Data.Attoparsec.ByteString.Fhthagn (inlinePerformIO)
7272import Data.Attoparsec.Combinator ((<?>))
7373import Data.Attoparsec.Internal.Types hiding (Parser, Failure, Success)
7474import Data.Word (Word8)
@@ -84,9 +84,6 @@ import qualified Data.ByteString.Internal as B
8484import qualified Data.ByteString.Lazy as L
8585import qualified Data.ByteString.Unsafe as B
8686
87−import GHC.Base (realWorld#)
88−import GHC.IO (IO(IO))
89−
9087type Parser = T.Parser B.ByteString B.ByteString
9188type Result = IResult B.ByteString B.ByteString
9289type Failure r = T.Failure B.ByteString B.ByteString r
@@ -426,14 +423,6 @@ parseOnly m s = case T.runParser m s (Pos 0) Complete failK successK of
426423 _ -> error "parseOnly: impossible error!"
427424{-# INLINE parseOnly #-}
428425
429−-- | Just like unsafePerformIO, but we inline it. Big performance gains as
430−-- it exposes lots of things to further inlining. /Very unsafe/. In
431−-- particular, you should do no memory allocation inside an
432−-- 'inlinePerformIO' block. On Hugs this is just @unsafePerformIO@.
433−inlinePerformIO :: IO a -> a
434−inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r
435−{-# INLINE inlinePerformIO #-}
436−
437426get :: Parser ByteString
438427get = T.Parser $ \t pos more _lose succ ->
439428 succ t pos more (B.unsafeDrop (fromPos pos) t)