[project @ 2005-02-01 16:47:27 by malcolm]
[ghc-base.git] / Data / Generics / Text.hs
index b6ce518..61ad5a7 100644 (file)
@@ -43,7 +43,7 @@ gshow :: Data a => a -> String
 -- 
 gshow = ( \t ->
                 "("
-             ++ conString (toConstr t)
+             ++ showConstr (toConstr t)
              ++ concat (gmapQ ((++) " " . gshow) t)
              ++ ")"
         ) `extQ` (show :: String -> String)
@@ -57,8 +57,8 @@ gread :: Data a => ReadS a
 
 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.
 
 -}
@@ -68,7 +68,7 @@ gread = readP_to_S gread'
  where
 
   -- Helper for recursive read
-  gread' :: Data a => ReadP a
+  gread' :: Data a' => ReadP a'
   gread' = allButString `extR` stringCase
 
    where
@@ -80,7 +80,7 @@ gread = readP_to_S gread'
     -- Determine result type
     myDataType = dataTypeOf (getArg allButString)
      where
-      getArg :: ReadP a -> a
+      getArg :: ReadP a'' -> a''
       getArg = undefined
 
     -- The generic default for gread
@@ -92,9 +92,9 @@ gread = readP_to_S 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
@@ -107,7 +107,7 @@ gread = readP_to_S gread'
     -- failing in the monad if it isn't a constructor of this data type
     str2con :: String -> ReadP Constr  
     str2con = maybe mzero return
-            . stringCon myDataType
+            . readConstr myDataType
 
     -- Get a Constr's string at the front of an input string
     parseConstr :: ReadP String