summaryrefslogtreecommitdiff
path: root/libraries/base/Text/ParserCombinators
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2013-09-15 23:05:05 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2013-09-17 09:54:07 +0200
commit0f5eae0232a86ec57d841a83e6929361e2751270 (patch)
tree7cc7b87fce8238cd9ff6b65fb0c37f515191aa6e /libraries/base/Text/ParserCombinators
parent43ece172e7045d5ba633be6193f3e908eaa81f00 (diff)
downloadhaskell-0f5eae0232a86ec57d841a83e6929361e2751270.tar.gz
Constant-fold `__GLASGOW_HASKELL__` CPP conditionals
Now that HUGS and NHC specific code has been removed, this commit "folds" the now redundant `#if((n)def)`s containing `__GLASGOW_HASKELL__`. This renders `base` officially GHC only. This commit also removes redundant `{-# LANGUAGE CPP #-}`. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Diffstat (limited to 'libraries/base/Text/ParserCombinators')
-rw-r--r--libraries/base/Text/ParserCombinators/ReadP.hs25
-rw-r--r--libraries/base/Text/ParserCombinators/ReadPrec.hs4
2 files changed, 2 insertions, 27 deletions
diff --git a/libraries/base/Text/ParserCombinators/ReadP.hs b/libraries/base/Text/ParserCombinators/ReadP.hs
index 72338848dd..a0e6e22062 100644
--- a/libraries/base/Text/ParserCombinators/ReadP.hs
+++ b/libraries/base/Text/ParserCombinators/ReadP.hs
@@ -1,9 +1,7 @@
{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NoImplicitPrelude #-}
+{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
-#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE MagicHash #-}
-#endif
-----------------------------------------------------------------------------
-- |
@@ -75,17 +73,12 @@ module Text.ParserCombinators.ReadP
import Control.Monad( MonadPlus(..), sequence, liftM2 )
-#ifdef __GLASGOW_HASKELL__
import {-# SOURCE #-} GHC.Unicode ( isSpace )
import GHC.List ( replicate, null )
import GHC.Base
-#else
-import Data.Char( isSpace )
-#endif
infixr 5 +++, <++
-#ifdef __GLASGOW_HASKELL__
------------------------------------------------------------------------
-- ReadS
@@ -95,7 +88,6 @@ infixr 5 +++, <++
-- Note that this kind of backtracking parser is very inefficient;
-- reading a large structure may be quite slow (cf 'ReadP').
type ReadS a = String -> [(a,String)]
-#endif
-- ---------------------------------------------------------------------------
-- The P type
@@ -209,7 +201,6 @@ R f1 +++ R f2 = R (\k -> f1 k `mplus` f2 k)
-- ^ Local, exclusive, left-biased choice: If left parser
-- locally produces any result at all, then right parser is
-- not used.
-#ifdef __GLASGOW_HASKELL__
R f0 <++ q =
do s <- look
probe (f0 return) s 0#
@@ -222,20 +213,6 @@ R f0 <++ q =
discard 0# = return ()
discard n = get >> discard (n-#1#)
-#else
-R f <++ q =
- do s <- look
- probe (f return) s 0
- where
- probe (Get f) (c:s) n = probe (f c) s (n+1)
- probe (Look f) s n = probe (f s) s n
- probe p@(Result _ _) _ n = discard n >> R (p >>=)
- probe (Final r) _ _ = R (Final r >>=)
- probe _ _ _ = q
-
- discard 0 = return ()
- discard n = get >> discard (n-1)
-#endif
gather :: ReadP a -> ReadP (String, a)
-- ^ Transforms a parser into one that does the same, but
diff --git a/libraries/base/Text/ParserCombinators/ReadPrec.hs b/libraries/base/Text/ParserCombinators/ReadPrec.hs
index ba59facb8b..235436c4d6 100644
--- a/libraries/base/Text/ParserCombinators/ReadPrec.hs
+++ b/libraries/base/Text/ParserCombinators/ReadPrec.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NoImplicitPrelude #-}
+{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
-- |
@@ -62,10 +62,8 @@ import qualified Text.ParserCombinators.ReadP as ReadP
)
import Control.Monad( MonadPlus(..) )
-#ifdef __GLASGOW_HASKELL__
import GHC.Num( Num(..) )
import GHC.Base
-#endif
-- ---------------------------------------------------------------------------
-- The readPrec type