--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
--- Portability : non-portable
+-- Portability : non-portable (uses Data.Generics.Basics)
--
-- \"Scrap your boilerplate\" --- Generic programming in Haskell
-- See <http://www.cs.vu.nl/boilerplate/>. The present module provides
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 gunfoldR to "parse" the input. To be
-precise, gunfoldR is used for all types except String. The
+and precedence as well.) We use fromConstrM to "parse" the input. To be
+precise, fromConstrM is used for all types except String. The
type-specific case for String uses basic String read.
-}
where
-- Helper for recursive read
- gread' :: Data a => ReadP a
+ gread' :: Data a' => ReadP a'
gread' = allButString `extR` stringCase
where
-- Determine result type
myDataType = dataTypeOf (getArg allButString)
where
- getArg :: ReadP a -> a
+ getArg :: ReadP a'' -> a''
getArg = undefined
-- The generic default for gread
skipSpaces -- Discard following space
-- Do the real work
- str <- parseConstr -- Get a lexeme for the constructor
- con <- str2con str -- Convert it to a Constr (may fail)
- x <- gunfoldR con gread' -- Read the children
+ str <- parseConstr -- Get a lexeme for the constructor
+ con <- str2con str -- Convert it to a Constr (may fail)
+ x <- fromConstrM gread' con -- Read the children
-- Drop " ) "
skipSpaces -- Discard leading space