From: panne Date: Mon, 4 Aug 2003 18:07:50 +0000 (+0000) Subject: [project @ 2003-08-04 18:07:49 by panne] X-Git-Tag: nhc98-1-18-release~550 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=44b215678f55a6d5b1d0a2e1edb035bd285ce909;p=haskell-directory.git [project @ 2003-08-04 18:07:49 by panne] Export ReadS from Text.ParserCombinators.ReadP, curing CPP trickery a bit --- diff --git a/GHC/Read.lhs b/GHC/Read.lhs index bfffb19..b67e83b 100644 --- a/GHC/Read.lhs +++ b/GHC/Read.lhs @@ -49,6 +49,7 @@ import qualified Text.ParserCombinators.ReadP as P import Text.ParserCombinators.ReadP ( ReadP + , ReadS , readP_to_S ) @@ -89,19 +90,12 @@ readParen b g = if b then mandatory else optional %********************************************************* %* * -\subsection{The @Read@ class and @ReadS@ type} +\subsection{The @Read@ class} %* * %********************************************************* \begin{code} ------------------------------------------------------------------------ --- ReadS - --- | A parser for a type @a@, represented as a function that takes a --- 'String' and returns a list of possible parses @(a,'String')@ pairs. -type ReadS a = String -> [(a,String)] - ------------------------------------------------------------------------- -- class Read class Read a where diff --git a/Text/ParserCombinators/ReadP.hs b/Text/ParserCombinators/ReadP.hs index 654eda0..8a9cc80 100644 --- a/Text/ParserCombinators/ReadP.hs +++ b/Text/ParserCombinators/ReadP.hs @@ -40,6 +40,7 @@ module Text.ParserCombinators.ReadP choice, -- :: [ReadP a] -> ReadP a -- * Running a parser + ReadS, -- :: *; = String -> [(a,String)] readP_to_S, -- :: ReadP a -> ReadS a readS_to_P, -- :: ReadS a -> ReadP a @@ -59,8 +60,11 @@ import Data.Char( isSpace ) infixr 5 +++, <++ #ifdef __GLASGOW_HASKELL__ --- We define a local version of ReadS here, --- because its "real" definition site is in GHC.Read +------------------------------------------------------------------------ +-- ReadS + +-- | A parser for a type @a@, represented as a function that takes a +-- 'String' and returns a list of possible parses @(a,'String')@ pairs. type ReadS a = String -> [(a,String)] #endif diff --git a/Text/ParserCombinators/ReadPrec.hs b/Text/ParserCombinators/ReadPrec.hs index ae4a365..1fbada4 100644 --- a/Text/ParserCombinators/ReadPrec.hs +++ b/Text/ParserCombinators/ReadPrec.hs @@ -47,6 +47,7 @@ module Text.ParserCombinators.ReadPrec import Text.ParserCombinators.ReadP ( ReadP + , ReadS , readP_to_S , readS_to_P ) @@ -136,12 +137,6 @@ choice ps = foldr (+++) pfail ps -- --------------------------------------------------------------------------- -- Converting between ReadPrec and Read -#ifdef __GLASGOW_HASKELL__ --- We define a local version of ReadS here, --- because its "real" definition site is in GHC.Read -type ReadS a = String -> [(a,String)] -#endif - readPrec_to_P :: ReadPrec a -> (Int -> ReadP a) readPrec_to_P (P f) = f