-- Portability : non-portable
--
-- \"Scrap your boilerplate\" --- Generic programming in Haskell
--- See <http://www.cs.vu.nl/boilerplate/>.
+-- See <http://www.cs.vu.nl/boilerplate/>. The present module provides
+-- generic operations for text serialisation of terms.
--
-----------------------------------------------------------------------------
module Data.Generics.Text (
- -- * Generic operations for string representations of terms
gshow,
gread
------------------------------------------------------------------------------
-
+#ifdef __HADDOCK__
+import Prelude
+#endif
import Control.Monad
import Data.Maybe
import Data.Typeable
import Data.Generics.Aliases
import Text.ParserCombinators.ReadP
-
------------------------------------------------------------------------------
This is a read operation which insists on prefix notation. (The
Haskell 98 read deals with infix operators subject to associativity
-and precedence as well.) We use gunfoldM to "parse" the input. To be
-precise, gunfoldM is used for all types except String. The
+and precedence as well.) We use gunfoldR to "parse" the input. To be
+precise, gunfoldR is used for all types except String. The
type-specific case for String uses basic String read.
-}
where
gread' :: Data a => ReadP a
- gread' = gdefault `extB` scase
+ gread' = gdefault `extR` scase
where
-- Do the real work
str <- parseConstr -- Get a lexeme for the constructor
con <- str2con str -- Convert it to a Constr (may fail)
- x <- gunfoldM con gread' -- Read the children
+ x <- gunfoldR con gread' -- Read the children
-- Drop " ) "
skipSpaces -- Discard leading space