[project @ 2002-04-11 12:03:43 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)
commit05e43a9bd25232efced01ce45d00b3b3ba12af51
tree5880adb1502869ff6975eb11ca156ca9eb8780e6
parentbbfd33a95258eb07d88722f1a9ea1dc840f07936
[project @ 2002-04-11 12:03:43 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.
12 files changed:
Data/Char.hs
GHC/Err.lhs
GHC/Exts.hs
GHC/IOBase.lhs
GHC/Read.lhs
GHC/Show.lhs
Makefile
Numeric.hs
System/Random.hs
Text/ParserCombinators/ReadP.lhs [new file with mode: 0644]
Text/ParserCombinators/ReadPrec.lhs [new file with mode: 0644]
Text/Read/Lex.lhs [new file with mode: 0644]