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
import Control.Monad( MonadPlus(..) )
#ifdef __GLASGOW_HASKELL__
-import GHC.Show( isSpace )
+#ifndef __HADDOCK__
+import {-# SOURCE #-} GHC.Unicode ( isSpace )
+#endif
import GHC.Base
#else
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
-- ---------------------------------------------------------------------------
-- The ReadP type
--- newtype temporarily turned into data
--- until compiler bug as found on 26 July 2003 is fixed;
--- contact SPJ or ralf@cwi.nl
---
-data ReadP a = R (forall b . (a -> P b) -> P b)
--- newtype ReadP a = R (forall b . (a -> P b) -> P b)
+newtype ReadP a = R (forall b . (a -> P b) -> P b)
-- Functor, Monad, MonadPlus
-- ^ Converts a parser into a Haskell ReadS-style function.
-- This is the main way in which you can \"run\" a 'ReadP' parser:
-- the expanded type is
--- @ readP_to_S :: ReadP a -> String -> [(String,String)] @
+-- @ readP_to_S :: ReadP a -> String -> [(a,String)] @
readP_to_S (R f) = run (f return)
readS_to_P :: ReadS a -> ReadP a