@@ -1,4 +1,4 @@
1−{-# LANGUAGE CPP, BangPatterns, ScopedTypeVariables #-}
1+{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
22-- |
33-- Module : Data.Attoparsec.Internal
44-- Copyright : Bryan O'Sullivan 2007-2014
@@ -22,11 +22,9 @@ module Data.Attoparsec.Internal
2222 ) where
2323
2424import Control.Applicative ((<$>))
25−#if __GLASGOW_HASKELL__ >= 700
25+import Data.Attoparsec.Internal.Types
2626import Data.ByteString (ByteString)
2727import Data.Text (Text)
28−#endif
29−import Data.Attoparsec.Internal.Types
3028import Prelude hiding (succ)
3129
3230-- | Compare two 'IResult' values for equality.
@@ -53,7 +51,6 @@ prompt t pos _more lose succ = Partial $ \s ->
5351 if nullChunk s
5452 then lose t pos Complete
5553 else succ (pappendChunk t s) pos Incomplete
56−#if __GLASGOW_HASKELL__ >= 700
5754{-# SPECIALIZE prompt :: State ByteString -> Pos -> More
5855 -> (State ByteString -> Pos -> More
5956 -> IResult ByteString r)
@@ -64,7 +61,6 @@ prompt t pos _more lose succ = Partial $ \s ->
6461 -> (State Text -> Pos -> More -> IResult Text r)
6562 -> (State Text -> Pos -> More -> IResult Text r)
6663 -> IResult Text r #-}
67−#endif
6864
6965-- | Immediately demand more input via a 'Partial' continuation
7066-- result.
@@ -75,10 +71,8 @@ demandInput = Parser $ \t pos more lose succ ->
7571 _ -> let lose' t' pos' more' = lose t' pos' more' [] "not enough input"
7672 succ' t' pos' more' = succ t' pos' more' ()
7773 in prompt t pos more lose' succ'
78−#if __GLASGOW_HASKELL__ >= 700
7974{-# SPECIALIZE demandInput :: Parser ByteString () #-}
8075{-# SPECIALIZE demandInput :: Parser Text () #-}
81−#endif
8276
8377-- | This parser always succeeds. It returns 'True' if any input is
8478-- available either immediately or on demand, and 'False' if the end
@@ -103,10 +97,8 @@ endOfInput = Parser $ \t pos more lose succ ->
10397 let lose' t' pos' more' _ctx _msg = succ t' pos' more' ()
10498 succ' t' pos' more' _a = lose t' pos' more' [] "endOfInput"
10599 in runParser demandInput t pos more lose' succ'
106−#if __GLASGOW_HASKELL__ >= 700
107100{-# SPECIALIZE endOfInput :: Parser ByteString () #-}
108101{-# SPECIALIZE endOfInput :: Parser Text () #-}
109−#endif
110102
111103-- | Return an indication of whether the end of input has been
112104-- reached.
@@ -127,7 +119,6 @@ satisfySuspended p t pos more lose succ =
127119 Just (e, l) | p e -> succ' t' (pos' + Pos l) more' e
128120 | otherwise -> lose' t' pos' more' [] "satisfyElem"
129121 Nothing -> runParser (demandInput >> go) t' pos' more' lose' succ'
130−#if __GLASGOW_HASKELL__ >= 700
131122{-# SPECIALIZE satisfySuspended :: (ChunkElem ByteString -> Bool)
132123 -> State ByteString -> Pos -> More
133124 -> Failure ByteString (State ByteString) r
@@ -140,7 +131,6 @@ satisfySuspended p t pos more lose succ =
140131 -> Success Text (State Text)
141132 (ChunkElem Text) r
142133 -> IResult Text r #-}
143−#endif
144134
145135-- | The parser @satisfyElem p@ succeeds for any chunk element for which the
146136-- predicate @p@ returns 'True'. Returns the element that is