summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4618e6c)
Export ReadS from Text.ParserCombinators.ReadP, curing CPP trickery a bit
import Text.ParserCombinators.ReadP
( ReadP
import Text.ParserCombinators.ReadP
( ReadP
%*********************************************************
%* *
%*********************************************************
%* *
-\subsection{The @Read@ class and @ReadS@ type}
+\subsection{The @Read@ class}
%* *
%*********************************************************
\begin{code}
------------------------------------------------------------------------
%* *
%*********************************************************
\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
-- class Read
class Read a where
choice, -- :: [ReadP a] -> ReadP a
-- * Running a parser
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
readP_to_S, -- :: ReadP a -> ReadS a
readS_to_P, -- :: ReadS a -> ReadP a
infixr 5 +++, <++
#ifdef __GLASGOW_HASKELL__
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
type ReadS a = String -> [(a,String)]
#endif
import Text.ParserCombinators.ReadP
( ReadP
import Text.ParserCombinators.ReadP
( ReadP
, readP_to_S
, readS_to_P
)
, readP_to_S
, readS_to_P
)
-- ---------------------------------------------------------------------------
-- Converting between ReadPrec and Read
-- ---------------------------------------------------------------------------
-- 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
readPrec_to_P :: ReadPrec a -> (Int -> ReadP a)
readPrec_to_P (P f) = f