projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tests from testsuite/tests/h98
[ghc-base.git]
/
Text
/
ParserCombinators
/
ReadP.hs
diff --git
a/Text/ParserCombinators/ReadP.hs
b/Text/ParserCombinators/ReadP.hs
index
fb506f6
..
27bba54
100644
(file)
--- a/
Text/ParserCombinators/ReadP.hs
+++ b/
Text/ParserCombinators/ReadP.hs
@@
-1,4
+1,11
@@
-{-# OPTIONS_GHC -XNoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+#ifndef __NHC__
+{-# LANGUAGE Rank2Types #-}
+#endif
+#ifdef __GLASGOW_HASKELL__
+{-# LANGUAGE MagicHash #-}
+#endif
+
-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.ReadP
-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.ReadP
@@
-255,9
+262,10
@@
gather :: ReadP a -> ReadP (String, a)
-- in addition returns the exact characters read.
-- IMPORTANT NOTE: 'gather' gives a runtime error if its first argument
-- is built using any occurrences of readS_to_P.
-- in addition returns the exact characters read.
-- IMPORTANT NOTE: 'gather' gives a runtime error if its first argument
-- is built using any occurrences of readS_to_P.
-gather (R m) =
- R (\k -> gath id (m (\a -> return (\s -> k (s,a)))))
+gather (R m)
+ = R (\k -> gath id (m (\a -> return (\s -> k (s,a)))))
where
where
+ gath :: (String -> String) -> P (String -> P b) -> P b
gath l (Get f) = Get (\c -> gath (l.(c:)) (f c))
gath _ Fail = Fail
gath l (Look f) = Look (\s -> gath l (f s))
gath l (Get f) = Get (\c -> gath (l.(c:)) (f c))
gath _ Fail = Fail
gath l (Look f) = Look (\s -> gath l (f s))