cvs commit: fptools/ghc/compiler/basicTypes MkId.lhs fptools/ghc/compiler/coreSyn
CoreUtils.lhs MkExternalCore.lhs fptools/ghc/compiler/deSugar
Desugar.lhs DsCCall.lhs DsExpr.lhs DsUtils.lhs
fptools/ghc/compiler/hsSyn HsDecls.lhs HsExpr.lhs ...
Simon Peyton Jones
simonpj@glass.cse.ogi.edu
Thu, 11 Apr 2002 05:03:46 -0700
simonpj 2002/04/11 05:03:45 PDT
Modified files:
ghc/compiler/basicTypes MkId.lhs
ghc/compiler/coreSyn CoreUtils.lhs MkExternalCore.lhs
ghc/compiler/deSugar Desugar.lhs DsCCall.lhs DsExpr.lhs
DsUtils.lhs
ghc/compiler/hsSyn HsDecls.lhs HsExpr.lhs
ghc/compiler/main DriverPhases.hs DriverPipeline.hs
HscMain.lhs
ghc/compiler/parser ParserCore.y ParserCoreUtils.hs
ghc/compiler/prelude PrelNames.lhs
ghc/compiler/rename Rename.lhs RnExpr.lhs RnIfaces.lhs
ghc/compiler/simplCore SimplUtils.lhs Simplify.lhs
ghc/compiler/stranal WorkWrap.lhs WwLib.lhs
ghc/compiler/typecheck Inst.lhs TcClassDcl.lhs TcDeriv.lhs
TcExpr.lhs TcGenDeriv.lhs TcHsSyn.lhs
TcIfaceSig.lhs TcInstDcls.lhs
TcModule.lhs TcPat.lhs TcTyClsDecls.lhs
TcTyDecls.lhs
ghc/compiler/utils UnicodeUtil.lhs
libraries/base Makefile Numeric.hs
libraries/base/Data Char.hs
libraries/base/GHC Err.lhs Exts.hs IOBase.lhs Read.lhs
Show.lhs
libraries/base/System Random.hs
Added files:
libraries/base/Text/ParserCombinators ReadP.lhs ReadPrec.lhs
libraries/base/Text/Read Lex.lhs
Log:
-------------------
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.
Revision Changes Path
1.94 +32 -48 fptools/ghc/compiler/basicTypes/MkId.lhs
1.100 +10 -8 fptools/ghc/compiler/coreSyn/CoreUtils.lhs
1.9 +11 -3 fptools/ghc/compiler/coreSyn/MkExternalCore.lhs
1.52 +10 -18 fptools/ghc/compiler/deSugar/Desugar.lhs
1.58 +3 -3 fptools/ghc/compiler/deSugar/DsCCall.lhs
1.84 +9 -14 fptools/ghc/compiler/deSugar/DsExpr.lhs
1.61 +17 -21 fptools/ghc/compiler/deSugar/DsUtils.lhs
1.90 +7 -1 fptools/ghc/compiler/hsSyn/HsDecls.lhs
1.65 +4 -5 fptools/ghc/compiler/hsSyn/HsExpr.lhs
1.19 +2 -2 fptools/ghc/compiler/main/DriverPhases.hs
1.129 +10 -1 fptools/ghc/compiler/main/DriverPipeline.hs
1.156 +7 -7 fptools/ghc/compiler/main/HscMain.lhs
1.3 +15 -9 fptools/ghc/compiler/parser/ParserCore.y
1.3 +19 -0 fptools/ghc/compiler/parser/ParserCoreUtils.hs
1.52 +45 -19 fptools/ghc/compiler/prelude/PrelNames.lhs
1.178 +41 -24 fptools/ghc/compiler/rename/Rename.lhs
1.89 +2 -3 fptools/ghc/compiler/rename/RnExpr.lhs
1.152 +26 -27 fptools/ghc/compiler/rename/RnIfaces.lhs
1.86 +2 -2 fptools/ghc/compiler/simplCore/SimplUtils.lhs
1.135 +3 -3 fptools/ghc/compiler/simplCore/Simplify.lhs
1.57 +9 -9 fptools/ghc/compiler/stranal/WorkWrap.lhs
1.65 +2 -3 fptools/ghc/compiler/stranal/WwLib.lhs
1.100 +7 -2 fptools/ghc/compiler/typecheck/Inst.lhs
1.115 +2 -1 fptools/ghc/compiler/typecheck/TcClassDcl.lhs
1.96 +4 -1 fptools/ghc/compiler/typecheck/TcDeriv.lhs
1.120 +20 -27 fptools/ghc/compiler/typecheck/TcExpr.lhs
1.81 +184 -207 fptools/ghc/compiler/typecheck/TcGenDeriv.lhs
1.76 +6 -83 fptools/ghc/compiler/typecheck/TcHsSyn.lhs
1.83 +16 -11 fptools/ghc/compiler/typecheck/TcIfaceSig.lhs
1.146 +5 -4 fptools/ghc/compiler/typecheck/TcInstDcls.lhs
1.136 +37 -25 fptools/ghc/compiler/typecheck/TcModule.lhs
1.76 +6 -7 fptools/ghc/compiler/typecheck/TcPat.lhs
1.90 +20 -22 fptools/ghc/compiler/typecheck/TcTyClsDecls.lhs
1.85 +7 -10 fptools/ghc/compiler/typecheck/TcTyDecls.lhs
1.4 +12 -9 fptools/ghc/compiler/utils/UnicodeUtil.lhs
1.23 +4 -2 fptools/libraries/base/Makefile
1.6 +52 -1 fptools/libraries/base/Numeric.hs
1.2 +3 -2 fptools/libraries/base/Data/Char.hs
1.4 +17 -25 fptools/libraries/base/GHC/Err.lhs
1.4 +2 -2 fptools/libraries/base/GHC/Exts.hs
1.8 +7 -1 fptools/libraries/base/GHC/IOBase.lhs
1.4 +407 -507 fptools/libraries/base/GHC/Read.lhs
1.5 +16 -7 fptools/libraries/base/GHC/Show.lhs
1.3 +2 -2 fptools/libraries/base/System/Random.hs