[project @ 2002-04-11 12:03:29 by simonpj]
authorsimonpj <unknown>
Thu, 11 Apr 2002 12:03:45 +0000 (12:03 +0000)
committersimonpj <unknown>
Thu, 11 Apr 2002 12:03:45 +0000 (12:03 +0000)
commita7b95beb6077ff7c330e98c3d5b9268f33b21827
tree93b24f61c3ece9b3d4fbc5193e1cf40948227d7e
parent9c73e25fe66e5ae6995199800ba722889e9551d5
[project @ 2002-04-11 12:03:29 by simonpj]
-------------------
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
libraries.

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.
35 files changed:
ghc/compiler/basicTypes/MkId.lhs
ghc/compiler/coreSyn/CoreUtils.lhs
ghc/compiler/coreSyn/MkExternalCore.lhs
ghc/compiler/deSugar/Desugar.lhs
ghc/compiler/deSugar/DsCCall.lhs
ghc/compiler/deSugar/DsExpr.lhs
ghc/compiler/deSugar/DsUtils.lhs
ghc/compiler/hsSyn/HsDecls.lhs
ghc/compiler/hsSyn/HsExpr.lhs
ghc/compiler/main/DriverPhases.hs
ghc/compiler/main/DriverPipeline.hs
ghc/compiler/main/HscMain.lhs
ghc/compiler/parser/ParserCore.y
ghc/compiler/parser/ParserCoreUtils.hs
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/rename/Rename.lhs
ghc/compiler/rename/RnExpr.lhs
ghc/compiler/rename/RnIfaces.lhs
ghc/compiler/simplCore/SimplUtils.lhs
ghc/compiler/simplCore/Simplify.lhs
ghc/compiler/stranal/WorkWrap.lhs
ghc/compiler/stranal/WwLib.lhs
ghc/compiler/typecheck/Inst.lhs
ghc/compiler/typecheck/TcClassDcl.lhs
ghc/compiler/typecheck/TcDeriv.lhs
ghc/compiler/typecheck/TcExpr.lhs
ghc/compiler/typecheck/TcGenDeriv.lhs
ghc/compiler/typecheck/TcHsSyn.lhs
ghc/compiler/typecheck/TcIfaceSig.lhs
ghc/compiler/typecheck/TcInstDcls.lhs
ghc/compiler/typecheck/TcModule.lhs
ghc/compiler/typecheck/TcPat.lhs
ghc/compiler/typecheck/TcTyClsDecls.lhs
ghc/compiler/typecheck/TcTyDecls.lhs
ghc/compiler/utils/UnicodeUtil.lhs