X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Text%2FParserCombinators%2FReadP.hs;h=27bba5404e158530acabcad7fb3f799dc7f61129;hb=41e8fba828acbae1751628af50849f5352b27873;hp=fb506f651b2843c42a9f30ad1f219141f5eafe04;hpb=f8fd2a5da08346a74c22e5abc8dcb757857fe8f2;p=ghc-base.git diff --git a/Text/ParserCombinators/ReadP.hs b/Text/ParserCombinators/ReadP.hs index fb506f6..27bba54 100644 --- 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 @@ -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. -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 + 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))