• simonpj's avatar
    [project @ 2002-04-11 12:03:29 by simonpj] · a7b95beb
    simonpj authored
    	Mainly derived Read
    This commit is a tangle of several things that somehow got wound up
    together, I'm afraid.
    The main course
    Replace the derived-Read machinery with Koen's cunning new parser
    combinator library.   The result should be
    	* much smaller code sizes from derived Read
    	* faster execution of derived Read
    WARNING: I have not thoroughly tested this stuff; I'd be glad if you did!
    	 All the hard work is done, but there may be a few nits.
    The Read class gets two new methods, not exposed
    in the H98 inteface of course:
      class Read a where
        readsPrec    :: Int -> ReadS a
        readList     :: ReadS [a]
        readPrec     :: ReadPrec a		-- NEW
        readListPrec :: ReadPrec [a]	-- NEW
    There are the following new libraries:
      Text.ParserCombinators.ReadP		Koens combinator parser
      Text.ParserCombinators.ReadPrec	Ditto, but with precedences
      Text.Read.Lex				An emasculated lexical analyser
    					that provides the functionality
    					of H98 'lex'
    TcGenDeriv is changed to generate code that uses the new libraries.
    The built-in instances of Read (List, Maybe, tuples, etc) use the new
    Other stuff
    1. Some fixes the the plumbing of external-core generation. Sigbjorn
    did most of the work earlier, but this commit completes the renaming and
    typechecking plumbing.
    2. Runtime error-generation functions, such as GHC.Err.recSelErr,
    GHC.Err.recUpdErr, etc, now take an Addr#, pointing to a UTF8-encoded
    C string, instead of a Haskell string.  This makes the *calls* to these
    functions easier to generate, and smaller too, which is a good thing.
    In particular, it means that MkId.mkRecordSelectorId doesn't need to
    be passed "unpackCStringId", which was GRUESOME; and that in turn means
    that tcTypeAndClassDecls doesn't need to be passed unf_env, which is
    a very worthwhile cleanup.   Win/win situation.
    3.  GHC now faithfully translates do-notation using ">>" for statements
    with no binding, just as the report says.  While I was there I tidied
    up HsDo to take a list of Ids instead of 3 (but now 4) separate Ids.
    Saves a bit of code here and there.  Also introduced Inst.newMethodFromName
    to package a common idiom.
MkExternalCore.lhs 6.32 KB