[project @ 2002-09-13 15:02:25 by simonpj]
authorsimonpj <unknown>
Fri, 13 Sep 2002 15:02:50 +0000 (15:02 +0000)
committersimonpj <unknown>
Fri, 13 Sep 2002 15:02:50 +0000 (15:02 +0000)
commit9af77fa423926fbda946b31e174173d0ec5ebac8
tree140cc94aa3e04f6e50c4bf07ceb0efe67d11b9c6
parent69e55e7476392a2b59b243a32065350c258d4970
[project @ 2002-09-13 15:02:25 by simonpj]
--------------------------------------
Make Template Haskell into the HEAD
--------------------------------------

This massive commit transfers to the HEAD all the stuff that
Simon and Tim have been doing on Template Haskell.  The
meta-haskell-branch is no more!

WARNING: make sure that you

  * Update your links if you are using link trees.
    Some modules have been added, some have gone away.

  * Do 'make clean' in all library trees.
    The interface file format has changed, and you can
    get strange panics (sadly) if GHC tries to read old interface files:
    e.g.  ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
  Binary.get(TyClDecl): ForeignType

  * You need to recompile the rts too; Linker.c has changed

However the libraries are almost unaltered; just a tiny change in
Base, and to the exports in Prelude.

NOTE: so far as TH itself is concerned, expression splices work
fine, but declaration splices are not complete.

---------------
The main change
---------------

The main structural change: renaming and typechecking have to be
interleaved, because we can't rename stuff after a declaration splice
until after we've typechecked the stuff before (and the splice
itself).

* Combine the renamer and typecheker monads into one
(TcRnMonad, TcRnTypes)
  These two replace TcMonad and RnMonad

* Give them a single 'driver' (TcRnDriver).  This driver
  replaces TcModule.lhs and Rename.lhs

* The haskell-src library package has a module
Language/Haskell/THSyntax
  which defines the Haskell data type seen by the TH programmer.

* New modules:
hsSyn/Convert.hs  converts THSyntax -> HsSyn
deSugar/DsMeta.hs  converts HsSyn -> THSyntax

* New module typecheck/TcSplice type-checks Template Haskell splices.

-------------
Linking stuff
-------------

* ByteCodeLink has been split into
ByteCodeLink (which links)
ByteCodeAsm (which assembles)

* New module ghci/ObjLink is the object-code linker.

* compMan/CmLink is removed entirely (was out of place)
  Ditto CmTypes (which was tiny)

* Linker.c initialises the linker when it is first used (no need to call
  initLinker any more).  Template Haskell makes it harder to know when
  and whether to initialise the linker.

-------------------------------------
Gathering the LIE in the type checker
-------------------------------------

* Instead of explicitly gathering constraints in the LIE
tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE)
  we now dump the constraints into a mutable varabiable carried
  by the monad, so we get
tcExpr :: RenamedExpr -> TcM TypecheckedExpr

  Much less clutter in the code, and more efficient too.
  (Originally suggested by Mark Shields.)

-----------------
Remove "SysNames"
-----------------

Because the renamer and the type checker were entirely separate,
we had to carry some rather tiresome implicit binders (or "SysNames")
along inside some of the HsDecl data structures.  They were both
tiresome and fragile.

Now that the typechecker and renamer are more intimately coupled,
we can eliminate SysNames (well, mostly... default methods still
carry something similar).

-------------
Clean up HsPat
-------------

One big clean up is this: instead of having two HsPat types (InPat and
OutPat), they are now combined into one.  This is more consistent with
the way that HsExpr etc is handled; there are some 'Out' constructors
for the type checker output.

So:
HsPat.InPat --> HsPat.Pat
HsPat.OutPat --> HsPat.Pat
No 'pat' type parameter in HsExpr, HsBinds, etc

Constructor patterns are nicer now: they use
HsPat.HsConDetails
for the three cases of constructor patterns:
prefix, infix, and record-bindings

The *same* data type HsConDetails is used in the type
declaration of the data type (HsDecls.TyData)

Lots of associated clean-up operations here and there.  Less code.
Everything is wonderful.
182 files changed:
ghc/compiler/Makefile
ghc/compiler/absCSyn/AbsCSyn.lhs
ghc/compiler/absCSyn/CLabel.lhs
ghc/compiler/basicTypes/BasicTypes.lhs
ghc/compiler/basicTypes/IdInfo.lhs
ghc/compiler/basicTypes/Literal.lhs
ghc/compiler/basicTypes/MkId.lhs
ghc/compiler/basicTypes/Module.lhs
ghc/compiler/basicTypes/Name.lhs
ghc/compiler/basicTypes/NameEnv.lhs
ghc/compiler/basicTypes/OccName.lhs
ghc/compiler/basicTypes/PprEnv.lhs [deleted file]
ghc/compiler/basicTypes/RdrName.lhs
ghc/compiler/basicTypes/SrcLoc.lhs
ghc/compiler/basicTypes/Var.lhs
ghc/compiler/codeGen/CgCase.lhs
ghc/compiler/codeGen/CgClosure.lhs
ghc/compiler/codeGen/CgExpr.lhs
ghc/compiler/codeGen/CgHeapery.lhs
ghc/compiler/codeGen/CgLetNoEscape.lhs
ghc/compiler/codeGen/CgMonad.lhs
ghc/compiler/codeGen/CgRetConv.lhs
ghc/compiler/codeGen/CgStackery.lhs
ghc/compiler/codeGen/ClosureInfo.lhs
ghc/compiler/codeGen/CodeGen.lhs
ghc/compiler/compMan/CmLink.lhs [deleted file]
ghc/compiler/compMan/CmTypes.lhs [deleted file]
ghc/compiler/compMan/CompManager.lhs
ghc/compiler/coreSyn/CoreFVs.lhs
ghc/compiler/coreSyn/CoreLint.lhs
ghc/compiler/coreSyn/CorePrep.lhs
ghc/compiler/coreSyn/CoreSyn.lhs
ghc/compiler/coreSyn/MkExternalCore.lhs
ghc/compiler/coreSyn/PprCore.lhs
ghc/compiler/count_lines
ghc/compiler/deSugar/Check.lhs
ghc/compiler/deSugar/Desugar.lhs
ghc/compiler/deSugar/DsBinds.lhs
ghc/compiler/deSugar/DsExpr.lhs
ghc/compiler/deSugar/DsForeign.lhs
ghc/compiler/deSugar/DsListComp.lhs
ghc/compiler/deSugar/DsMeta.hs [new file with mode: 0644]
ghc/compiler/deSugar/DsMonad.lhs
ghc/compiler/deSugar/DsUtils.lhs
ghc/compiler/deSugar/Match.lhs
ghc/compiler/deSugar/MatchCon.lhs
ghc/compiler/deSugar/MatchLit.lhs
ghc/compiler/ghci/ByteCodeAsm.lhs [new file with mode: 0644]
ghc/compiler/ghci/ByteCodeFFI.lhs
ghc/compiler/ghci/ByteCodeGen.lhs
ghc/compiler/ghci/ByteCodeInstr.lhs
ghc/compiler/ghci/ByteCodeItbls.lhs
ghc/compiler/ghci/ByteCodeLink.lhs
ghc/compiler/ghci/InteractiveUI.hs
ghc/compiler/ghci/Linker.lhs
ghc/compiler/ghci/ObjLink.lhs [new file with mode: 0644]
ghc/compiler/hsSyn/Convert.lhs [new file with mode: 0644]
ghc/compiler/hsSyn/HsBinds.lhs
ghc/compiler/hsSyn/HsCore.lhs
ghc/compiler/hsSyn/HsDecls.lhs
ghc/compiler/hsSyn/HsExpr.hi-boot
ghc/compiler/hsSyn/HsExpr.hi-boot-5
ghc/compiler/hsSyn/HsExpr.hi-boot-6
ghc/compiler/hsSyn/HsExpr.lhs
ghc/compiler/hsSyn/HsImpExp.lhs
ghc/compiler/hsSyn/HsPat.lhs
ghc/compiler/hsSyn/HsSyn.lhs
ghc/compiler/hsSyn/HsTypes.lhs
ghc/compiler/main/BinIface.hs
ghc/compiler/main/CodeOutput.lhs
ghc/compiler/main/Constants.lhs
ghc/compiler/main/DriverFlags.hs
ghc/compiler/main/DriverMkDepend.hs
ghc/compiler/main/DriverPhases.hs
ghc/compiler/main/DriverPipeline.hs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/DriverUtil.hs
ghc/compiler/main/ErrUtils.lhs
ghc/compiler/main/Finder.lhs
ghc/compiler/main/GetImports.hs
ghc/compiler/main/HscMain.lhs
ghc/compiler/main/HscStats.lhs
ghc/compiler/main/HscTypes.lhs
ghc/compiler/main/Interpreter.hs
ghc/compiler/main/Main.hs
ghc/compiler/main/MkIface.lhs
ghc/compiler/main/Packages.lhs
ghc/compiler/main/SysTools.lhs
ghc/compiler/main/TidyPgm.lhs
ghc/compiler/nativeGen/AsmCodeGen.lhs
ghc/compiler/ndpFlatten/FlattenInfo.hs
ghc/compiler/ndpFlatten/FlattenMonad.hs
ghc/compiler/ndpFlatten/Flattening.hs
ghc/compiler/parser/Lex.lhs
ghc/compiler/parser/ParseUtil.lhs
ghc/compiler/parser/Parser.y
ghc/compiler/parser/ParserCore.y
ghc/compiler/parser/RdrHsSyn.lhs
ghc/compiler/prelude/PrelInfo.lhs
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/prelude/PrelRules.lhs
ghc/compiler/prelude/PrimOp.lhs
ghc/compiler/prelude/TysWiredIn.lhs
ghc/compiler/rename/Rename.lhs [deleted file]
ghc/compiler/rename/RnBinds.hi-boot [deleted file]
ghc/compiler/rename/RnBinds.hi-boot-5 [deleted file]
ghc/compiler/rename/RnBinds.hi-boot-6 [deleted file]
ghc/compiler/rename/RnBinds.lhs
ghc/compiler/rename/RnEnv.lhs
ghc/compiler/rename/RnExpr.lhs
ghc/compiler/rename/RnHiFiles.hi-boot-5
ghc/compiler/rename/RnHiFiles.hi-boot-6
ghc/compiler/rename/RnHiFiles.lhs
ghc/compiler/rename/RnHsSyn.lhs
ghc/compiler/rename/RnIfaces.lhs
ghc/compiler/rename/RnMonad.lhs [deleted file]
ghc/compiler/rename/RnNames.lhs
ghc/compiler/rename/RnSource.hi-boot-5 [new file with mode: 0644]
ghc/compiler/rename/RnSource.hi-boot-6 [new file with mode: 0644]
ghc/compiler/rename/RnSource.lhs
ghc/compiler/rename/RnTypes.lhs
ghc/compiler/simplCore/FloatOut.lhs
ghc/compiler/simplCore/SetLevels.lhs
ghc/compiler/simplCore/SimplCore.lhs
ghc/compiler/specialise/SpecConstr.lhs
ghc/compiler/specialise/Specialise.lhs
ghc/compiler/stgSyn/CoreToStg.lhs
ghc/compiler/stgSyn/StgLint.lhs
ghc/compiler/stranal/DmdAnal.lhs
ghc/compiler/typecheck/Inst.lhs
ghc/compiler/typecheck/TcBinds.lhs
ghc/compiler/typecheck/TcClassDcl.lhs
ghc/compiler/typecheck/TcDefaults.lhs
ghc/compiler/typecheck/TcDeriv.lhs
ghc/compiler/typecheck/TcEnv.hi-boot [deleted file]
ghc/compiler/typecheck/TcEnv.hi-boot-5 [deleted file]
ghc/compiler/typecheck/TcEnv.hi-boot-6 [deleted file]
ghc/compiler/typecheck/TcEnv.lhs
ghc/compiler/typecheck/TcExpr.hi-boot
ghc/compiler/typecheck/TcExpr.hi-boot-5
ghc/compiler/typecheck/TcExpr.hi-boot-6
ghc/compiler/typecheck/TcExpr.lhs
ghc/compiler/typecheck/TcForeign.lhs
ghc/compiler/typecheck/TcGenDeriv.lhs
ghc/compiler/typecheck/TcHsSyn.lhs
ghc/compiler/typecheck/TcIfaceSig.lhs
ghc/compiler/typecheck/TcInstDcls.lhs
ghc/compiler/typecheck/TcMType.lhs
ghc/compiler/typecheck/TcMatches.hi-boot
ghc/compiler/typecheck/TcMatches.hi-boot-5
ghc/compiler/typecheck/TcMatches.hi-boot-6
ghc/compiler/typecheck/TcMatches.lhs
ghc/compiler/typecheck/TcModule.lhs [deleted file]
ghc/compiler/typecheck/TcMonad.lhs [deleted file]
ghc/compiler/typecheck/TcMonoType.lhs
ghc/compiler/typecheck/TcPat.lhs
ghc/compiler/typecheck/TcRnDriver.lhs [new file with mode: 0644]
ghc/compiler/typecheck/TcRnMonad.lhs [new file with mode: 0644]
ghc/compiler/typecheck/TcRnTypes.lhs [new file with mode: 0644]
ghc/compiler/typecheck/TcRules.lhs
ghc/compiler/typecheck/TcSimplify.lhs
ghc/compiler/typecheck/TcSplice.hi-boot-6 [new file with mode: 0644]
ghc/compiler/typecheck/TcSplice.lhs [new file with mode: 0644]
ghc/compiler/typecheck/TcTyClsDecls.lhs
ghc/compiler/typecheck/TcTyDecls.lhs
ghc/compiler/typecheck/TcType.lhs
ghc/compiler/typecheck/TcUnify.hi-boot
ghc/compiler/typecheck/TcUnify.hi-boot-5
ghc/compiler/typecheck/TcUnify.hi-boot-6
ghc/compiler/typecheck/TcUnify.lhs
ghc/compiler/types/FunDeps.lhs
ghc/compiler/types/Generics.lhs
ghc/compiler/types/InstEnv.lhs
ghc/compiler/types/PprType.lhs
ghc/compiler/types/Type.lhs
ghc/compiler/utils/Binary.hs
ghc/compiler/utils/Outputable.lhs
ghc/compiler/utils/Panic.lhs
ghc/compiler/utils/Pretty.lhs
ghc/compiler/utils/StringBuffer.lhs
ghc/docs/users_guide/glasgow_exts.sgml
ghc/rts/Linker.c