[project @ 2001-02-20 09:40:43 by simonpj]
authorsimonpj <unknown>
Tue, 20 Feb 2001 09:40:45 +0000 (09:40 +0000)
committersimonpj <unknown>
Tue, 20 Feb 2001 09:40:45 +0000 (09:40 +0000)
commit5e6242927839c8ddc73a55eb7828c0b7e4cc3ab2
treeb6c06be5a9254bb43551ebfa68a2067560701ff3
parentd5c7622a852d7fb55120706ac75ae1323ce3939f
[project @ 2001-02-20 09:40:43 by simonpj]
Decoupling the Prelude [HsExpr, HsLit, HsPat, ParseUtil, Parser.y, PrelNames,
~~~~~~~~~~~~~~~~~~~~~~  Rename, RnEnv, RnExpr, RnHsSyn, Inst, TcEnv, TcMonad,
TcPat, TcExpr]
The -fno-implicit-prelude flag is meant to arrange that when you write
3
you get
fromInt 3
where 'fromInt' is whatever fromInt is in scope at the top level of
the module being compiled.  Similarly for
* numeric patterns
* n+k patterns
* negation

This used to work, but broke when we made the static/dynamic flag distinction.
It's now tidied up a lot.  Here's the plan:

  - PrelNames contains sugarList :: SugarList, which maps built-in names
    to the RdrName that should replace them.

  - The renamer makes a finite map :: SugarMap, which maps the built-in names
    to the Name of the re-mapped thing

  - The typechecker consults this map via tcLookupSyntaxId when it is doing
    numeric things

At present I've only decoupled numeric syntax, since that is the main demand,
but the scheme is much more robustly extensible than the previous method.

As a result some HsSyn constructors don't need to carry names in them
(notably HsOverLit, NegApp, NPlusKPatIn)
15 files changed:
ghc/compiler/hsSyn/HsExpr.lhs
ghc/compiler/hsSyn/HsLit.lhs
ghc/compiler/hsSyn/HsPat.lhs
ghc/compiler/parser/ParseUtil.lhs
ghc/compiler/parser/Parser.y
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/rename/Rename.lhs
ghc/compiler/rename/RnEnv.lhs
ghc/compiler/rename/RnExpr.lhs
ghc/compiler/rename/RnHsSyn.lhs
ghc/compiler/typecheck/Inst.lhs
ghc/compiler/typecheck/TcEnv.lhs
ghc/compiler/typecheck/TcExpr.lhs
ghc/compiler/typecheck/TcMonad.lhs
ghc/compiler/typecheck/TcPat.lhs