[rearrange library a bunch more. move 'Read' to Jhc.Text.Read
John Meacham <john@repetae.net>**20080218011716] adddir ./lib/base/Jhc/Text
addfile ./lib/base/Jhc/Text/Read.hs
hunk ./data/names.txt 51
-Read            Prelude.Text.Read
+Read            Jhc.Text.Read
hunk ./lib/base/Data/Char.hs 87
-lexLitChar          :: ReadS String
-lexLitChar ('\\':s) =  map (prefix '\\') (lexEsc s)
-        where
-          lexEsc :: String -> [(String,String)]
-          lexEsc (c:s)     | c `elem` "abfnrtv\\\"'"  = [([c],s)]
-          lexEsc ('^':(c:s)) | (c >= '@') && (c <= '_') = [(['^',c],s)]
-
-          -- Numeric escapes
-          lexEsc ('o':s)               = [prefix 'o' (span isOctDigit s)]
-          lexEsc ('x':s)               = [prefix 'x' (span isHexDigit s)]
-          lexEsc s@(d:_)   | isDigit d = [span isDigit s]
-
-          -- Very crude approximation to \XYZ.
-          lexEsc s@(c:_)   | isUpper c = [span isCharName s]
-          lexEsc _                     = []
-
-          isCharName c   = isUpper c || isDigit c
-          prefix c (t,s) = (c:t, s)
-
-lexLitChar (c:s)    =  [([c],s)]
-lexLitChar ""       =  []
-
-
hunk ./lib/base/Data/Maybe.hs 1
-
+{-# OPTIONS_JHC -N #-}
hunk ./lib/base/Data/Maybe.hs 12
-import Prelude
+import Jhc.Maybe
+import Jhc.Order
+import Jhc.Basics
+import Jhc.IO
hunk ./lib/base/Jhc/List.hs 93
+-- elem is the list membership predicate, usually written in infix form,
+-- e.g., x `elem` xs.  notElem is the negation.
+
+infix  4  `elem`, `notElem`
+
+
+-- the implementation looks a little funny, but the reason for the
+-- inner loop is so that both the == function and the unboxing of the
+-- argument may occur right away outside the inner loop when the list isn't
+-- empty.
+
+
+elem, notElem    :: (Eq a) => a -> [a] -> Bool
+elem _ []	= False
+elem x (y:ys)
+    | x == y = True
+    | otherwise = f y ys where
+        f y _ | x == y = True
+        f _ (y:ys) = f y ys
+        f _ [] = False
+
+{-# SPECIALIZE elem :: Char -> String -> Bool #-}
+{-# SPECIALIZE elem :: Int -> [Int] -> Bool #-}
+{-# RULES "elem/[]" forall c . elem c [] = False #-}
+{-# RULES "elem/[_]" forall c v . elem c [v] = c == v #-}
+
+notElem	_ []	=  True
+notElem x (y:ys)
+    | x == y = False
+    | otherwise = f y ys where
+        f y ys | x == y = False
+        f _ (y:ys) = f y ys
+        f _ [] = True
+
+{-# SPECIALIZE notElem :: Char -> String -> Bool #-}
+{-# SPECIALIZE notElem :: Int -> [Int] -> Bool #-}
+{-# RULES "notElem/[]" forall c . notElem c [] = True #-}
+{-# RULES "notElem/[_]" forall c v . notElem c [v] = c /= v #-}
+
hunk ./lib/base/Jhc/List.hs 267
+-- takeWhile, applied to a predicate p and a list xs, returns the longest
+-- prefix (possibly empty) of xs of elements that satisfy p.  dropWhile p xs
+-- returns the remaining suffix.  span p xs is equivalent to
+-- (takeWhile p xs, dropWhile p xs), while break p uses the negation of p.
+
+
+takeWhile               :: (a -> Bool) -> [a] -> [a]
+takeWhile p []          =  []
+takeWhile p (x:xs)
+            | p x       =  x : takeWhile p xs
+            | otherwise =  []
+
+
+dropWhile               :: (a -> Bool) -> [a] -> [a]
+dropWhile p []          =  []
+dropWhile p xs@(x:xs')
+            | p x       =  dropWhile p xs'
+            | otherwise =  xs
+
+span, break             :: (a -> Bool) -> [a] -> ([a],[a])
+span p []            = ([],[])
+span p xs@(x:xs')
+            | p x       =  (x:ys,zs)
+            | otherwise =  ([],xs)
+                           where (ys,zs) = span p xs'
+
+{-# INLINE break #-}
+break p                 =  span (not . p)
+
hunk ./lib/base/Jhc/Text/Read.hs 1
+{-# OPTIONS_JHC -N #-}
+module Jhc.Text.Read where
+
+import Jhc.Basics
+import Jhc.Order
+import Jhc.Int
+import Jhc.List
+import Prelude.CType
+
+type  ReadS a  = String -> [(a,String)]
+
+class  Read a  where
+    readsPrec        :: Int -> ReadS a
+    readList         :: ReadS [a]
+
+        -- Minimal complete definition:
+        --      readsPrec
+    readList         = readParen False (\r -> [pr | ("[",s)  <- lex r,
+                                                    pr       <- readl s])
+                       where readl  s = [([],t)   | ("]",t)  <- lex s] ++
+                                        [(x:xs,u) | (x,t)    <- reads s,
+                                                    (xs,u)   <- readl' t]
+                             readl' s = [([],t)   | ("]",t)  <- lex s] ++
+                                        [(x:xs,v) | (",",t)  <- lex s,
+                                                    (x,u)    <- reads t,
+                                                    (xs,v)   <- readl' u]
+
+reads            :: (Read a) => ReadS a
+reads            =  readsPrec zero
+
+readParen        :: Bool -> ReadS a -> ReadS a
+readParen b g    =  if b then mandatory else optional
+                    where optional r  = g r ++ mandatory r
+                          mandatory r = [(x,u) | ("(",s) <- lex r,
+                                                 (x,t)   <- optional s,
+                                                 (")",u) <- lex t    ]
+
+
+-- This lexer is not completely faithful to the Haskell lexical syntax.
+-- Current limitations:
+--    Qualified names are not handled properly
+--    Octal and hexidecimal numerics are not recognized as a single token
+--    Comments are not treated properly
+
+lex              :: ReadS String
+lex ""           =  [("","")]
+lex (c:s)
+   | isSpace c   =  lex (dropWhile isSpace s)
+lex ('\'':s)     =  [('\'':ch++"'", t) | (ch,'\'':t)  <- lexLitChar s,
+                                         ch /= "'" ]
+lex ('"':s)      =  [('"':str, t)      | (str,t) <- lexString s]
+                    where
+                    lexString ('"':s) = [("\"",s)]
+                    lexString s = [(ch++str, u)
+                                         | (ch,t)  <- lexStrItem s,
+                                           (str,u) <- lexString t  ]
+
+                    lexStrItem ('\\':('&':s)) =  [("\\&",s)]
+                    lexStrItem ('\\':(c:s)) | isSpace c
+                                           =  [("\\&",t) |
+                                               '\\':t <-
+                                                   [dropWhile isSpace s]]
+                    lexStrItem s           =  lexLitChar s
+
+lex (c:s) | isSingle c = [([c],s)]
+          | isSym c    = [(c:sym,t)       | (sym,t) <- [span isSym s]]
+          | isAlpha c  = [(c:nam,t)       | (nam,t) <- [span isIdChar s]]
+          | isDigit c  = [(c:(ds++fe),t)  | (ds,s')  <- [span isDigit s],
+                                            (fe,t)  <- lexFracExp s'     ]
+          | otherwise  = []    -- bad character
+             where
+              isSingle c =  c `elem` ",;()[]{}_`"
+              isSym c    =  c `elem` "!@#$%&*+./<=>?\\^|:-~"
+              isIdChar c =  isAlphaNum c || c `elem` "_'"
+
+              lexFracExp ('.':(c:cs)) | isDigit c
+                            = [('.':ds++e,u) | (ds,t) <- lexDigits (c:cs),
+                                               (e,u)  <- lexExp t]
+              lexFracExp s  = lexExp s
+
+              lexExp (e:s) | e `elem` "eE"
+                       = [(e:c:ds,u) | (c:t)  <- [s], c `elem` "+-",
+                                                 (ds,u) <- lexDigits t] ++
+                         [(e:ds,t)   | (ds,t) <- lexDigits s]
+              lexExp s = [("",s)]
+
+asciiTab :: [String]
+asciiTab = --listArray ('\NUL', ' ')
+           ["NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
+            "BS",  "HT",  "LF",  "VT",  "FF",  "CR",  "SO",  "SI",
+            "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
+            "CAN", "EM",  "SUB", "ESC", "FS",  "GS",  "RS",  "US",
+            "SP"]
+
+lexLitChar          :: ReadS String
+lexLitChar ('\\':s) =  map (prefix '\\') (lexEsc s)
+        where
+          lexEsc :: String -> [(String,String)]
+          lexEsc (c:s)     | c `elem` "abfnrtv\\\"'"  = [([c],s)]
+          lexEsc ('^':(c:s)) | (c >= '@') && (c <= '_') = [(['^',c],s)]
+
+          -- Numeric escapes
+          lexEsc ('o':s)               = [prefix 'o' (span isOctDigit s)]
+          lexEsc ('x':s)               = [prefix 'x' (span isHexDigit s)]
+          lexEsc s@(d:_)   | isDigit d = [span isDigit s]
+
+          -- Very crude approximation to \XYZ.
+          lexEsc s@(c:_)   | isUpper c = [span isCharName s]
+          lexEsc _                     = []
+
+          isCharName c   = isUpper c || isDigit c
+          prefix c (t,s) = (c:t, s)
+
+lexLitChar (c:s)    =  [([c],s)]
+lexLitChar ""       =  []
+
+lexDigits        :: ReadS String
+lexDigits        =  nonnull isDigit
+
+nonnull          :: (Char -> Bool) -> ReadS String
+nonnull p s      =  [(cs,t) | (cs@(_:_),t) <- [span p s]]
+
hunk ./lib/base/Jhc/Tuples.hs 1
+{-# OPTIONS_JHC -N #-}
hunk ./lib/base/Jhc/Tuples.hs 7
+import Jhc.Basics
+import Jhc.Show
+import Jhc.Order
+import Jhc.List
+import Jhc.Text.Read
hunk ./lib/base/Numeric.hs 16
+import Jhc.Text.Read
hunk ./lib/base/Numeric.hs 361
-lexDigits        :: ReadS String
-lexDigits        =  nonnull isDigit
-
-nonnull          :: (Char -> Bool) -> ReadS String
-nonnull p s      =  [(cs,t) | (cs@(_:_),t) <- [span p s]]
-
hunk ./lib/base/Prelude/Float.hs 1
-{-# OPTIONS_JHC -fffi  #-}
+{-# OPTIONS_JHC -N -fffi  #-}
hunk ./lib/base/Prelude/Float.hs 17
+import Prelude.Text
+import Jhc.List
+import Prelude((^),(^^),elem,take)
hunk ./lib/base/Prelude/Text.hs 11
-import Prelude
hunk ./lib/base/Prelude/Text.hs 14
+import Jhc.Basics
+import Jhc.Monad
+import Jhc.IO
+import Prelude.IO
+import Jhc.Order
+import Jhc.Maybe
+import Jhc.Text.Read
hunk ./lib/base/Prelude/Text.hs 41
-type  ReadS a  = String -> [(a,String)]
hunk ./lib/base/Prelude/Text.hs 42
-class  Read a  where
-    readsPrec        :: Int -> ReadS a
-    readList         :: ReadS [a]
-
-        -- Minimal complete definition:
-        --      readsPrec
-    readList         = readParen False (\r -> [pr | ("[",s)  <- lex r,
-                                                    pr       <- readl s])
-                       where readl  s = [([],t)   | ("]",t)  <- lex s] ++
-                                        [(x:xs,u) | (x,t)    <- reads s,
-                                                    (xs,u)   <- readl' t]
-                             readl' s = [([],t)   | ("]",t)  <- lex s] ++
-                                        [(x:xs,v) | (",",t)  <- lex s,
-                                                    (x,u)    <- reads t,
-                                                    (xs,v)   <- readl' u]
-
-
-reads            :: (Read a) => ReadS a
-reads            =  readsPrec 0
hunk ./lib/base/Prelude/Text.hs 49
-readParen        :: Bool -> ReadS a -> ReadS a
-readParen b g    =  if b then mandatory else optional
-                    where optional r  = g r ++ mandatory r
-                          mandatory r = [(x,u) | ("(",s) <- lex r,
-                                                 (x,t)   <- optional s,
-                                                 (")",u) <- lex t    ]
-
--- This lexer is not completely faithful to the Haskell lexical syntax.
--- Current limitations:
---    Qualified names are not handled properly
---    Octal and hexidecimal numerics are not recognized as a single token
---    Comments are not treated properly
-
-lex              :: ReadS String
-lex ""           =  [("","")]
-lex (c:s)
-   | isSpace c   =  lex (dropWhile isSpace s)
-lex ('\'':s)     =  [('\'':ch++"'", t) | (ch,'\'':t)  <- lexLitChar s,
-                                         ch /= "'" ]
-lex ('"':s)      =  [('"':str, t)      | (str,t) <- lexString s]
-                    where
-                    lexString ('"':s) = [("\"",s)]
-                    lexString s = [(ch++str, u)
-                                         | (ch,t)  <- lexStrItem s,
-                                           (str,u) <- lexString t  ]
-
-                    lexStrItem ('\\':('&':s)) =  [("\\&",s)]
-                    lexStrItem ('\\':(c:s)) | isSpace c
-                                           =  [("\\&",t) |
-                                               '\\':t <-
-                                                   [dropWhile isSpace s]]
-                    lexStrItem s           =  lexLitChar s
-
-lex (c:s) | isSingle c = [([c],s)]
-          | isSym c    = [(c:sym,t)       | (sym,t) <- [span isSym s]]
-          | isAlpha c  = [(c:nam,t)       | (nam,t) <- [span isIdChar s]]
-          | isDigit c  = [(c:(ds++fe),t)  | (ds,s')  <- [span isDigit s],
-                                            (fe,t)  <- lexFracExp s'     ]
-          | otherwise  = []    -- bad character
-             where
-              isSingle c =  c `elem` ",;()[]{}_`"
-              isSym c    =  c `elem` "!@#$%&*+./<=>?\\^|:-~"
-              isIdChar c =  isAlphaNum c || c `elem` "_'"
-
-              lexFracExp ('.':(c:cs)) | isDigit c
-                            = [('.':ds++e,u) | (ds,t) <- lexDigits (c:cs),
-                                               (e,u)  <- lexExp t]
-              lexFracExp s  = lexExp s
-
-              lexExp (e:s) | e `elem` "eE"
-                       = [(e:c:ds,u) | (c:t)  <- [s], c `elem` "+-",
-                                                 (ds,u) <- lexDigits t] ++
-                         [(e:ds,t)   | (ds,t) <- lexDigits s]
-              lexExp s = [("",s)]
hunk ./lib/base/Prelude.hs 26
+    takeWhile,
+    dropWhile,
+    span,
+    break,
hunk ./lib/base/Prelude.hs 43
+    elem,notElem,
hunk ./lib/base/Prelude.hs 289
--- takeWhile, applied to a predicate p and a list xs, returns the longest
--- prefix (possibly empty) of xs of elements that satisfy p.  dropWhile p xs
--- returns the remaining suffix.  span p xs is equivalent to
--- (takeWhile p xs, dropWhile p xs), while break p uses the negation of p.
-
-
-takeWhile               :: (a -> Bool) -> [a] -> [a]
-takeWhile p []          =  []
-takeWhile p (x:xs)
-            | p x       =  x : takeWhile p xs
-            | otherwise =  []
-
-
-dropWhile               :: (a -> Bool) -> [a] -> [a]
-dropWhile p []          =  []
-dropWhile p xs@(x:xs')
-            | p x       =  dropWhile p xs'
-            | otherwise =  xs
-
-span, break             :: (a -> Bool) -> [a] -> ([a],[a])
-span p []            = ([],[])
-span p xs@(x:xs')
-            | p x       =  (x:ys,zs)
-            | otherwise =  ([],xs)
-                           where (ys,zs) = span p xs'
-
-{-# INLINE break #-}
-break p                 =  span (not . p)
-
hunk ./lib/base/Prelude.hs 323
--- elem is the list membership predicate, usually written in infix form,
--- e.g., x `elem` xs.  notElem is the negation.
-
-infix  4  `elem`, `notElem`
-
-
--- the implementation looks a little funny, but the reason for the
--- inner loop is so that both the == function and the unboxing of the
--- argument may occur right away outside the inner loop when the list isn't
--- empty.
-
-
-elem, notElem    :: (Eq a) => a -> [a] -> Bool
-elem _ []	= False
-elem x (y:ys)
-    | x == y = True
-    | otherwise = f y ys where
-        f y _ | x == y = True
-        f _ (y:ys) = f y ys
-        f _ [] = False
-
-{-# SPECIALIZE elem :: Char -> String -> Bool #-}
-{-# SPECIALIZE elem :: Int -> [Int] -> Bool #-}
-{-# RULES "elem/[]" forall c . elem c [] = False #-}
-{-# RULES "elem/[_]" forall c v . elem c [v] = c == v #-}
-
-notElem	_ []	=  True
-notElem x (y:ys)
-    | x == y = False
-    | otherwise = f y ys where
-        f y ys | x == y = False
-        f _ (y:ys) = f y ys
-        f _ [] = True
-
-{-# SPECIALIZE notElem :: Char -> String -> Bool #-}
-{-# SPECIALIZE notElem :: Int -> [Int] -> Bool #-}
-{-# RULES "notElem/[]" forall c . notElem c [] = True #-}
-{-# RULES "notElem/[_]" forall c v . notElem c [v] = c /= v #-}