| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Housekeeping:
- The main goal is to remove dependencies on hslibs for a
bootstrapped compiler, leaving only a requirement that the
packages base, haskell98 and readline are built in stage 1 in
order to bootstrap. We're almost there: Posix is still required
for signal handling, but all other dependencies on hslibs are now
gone.
Uses of Addr and ByteArray/MutableByteArray array are all gone
from the compiler. PrimPacked defines the Ptr type for GHC 4.08
(which didn't have it), and it defines simple BA and MBA types to
replace uses of ByteArray and MutableByteArray respectively.
- Clean up import lists. HsVersions.h now defines macros for some
modules which have moved between GHC versions. eg. one now
imports 'GLAEXTS' to get at unboxed types and primops in the
compiler.
Many import lists have been sorted as per the recommendations in
the new style guidelines in the commentary.
I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and
itself, and everything still works here. Doubtless I've got something
wrong, though.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow infix type constructors
This commit adds infix type constructors (but not yet class constructors).
The documentation describes what should be the case. Lots of tiresome
changes, but nothing exciting.
Allows infix type constructors everwhere a type can occur, and in a data
or type synonym decl. E.g.
data a :*: b = ....
You can give fixity decls for type constructors, but the fixity decl
applies both to the tycon and the corresponding data con.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------
Change
GlobalName --> ExternalName
LocalName -> InternalName
------------------------
For a long time there's been terminological confusion between
GlobalName vs LocalName (property of a Name)
GlobalId vs LocalId (property of an Id)
I've now changed the terminology for Name to be
ExternalName vs InternalName
I've also added quite a bit of documentation in the Commentary.
|
|
|
|
| |
Include the fixity declaration for 'seq' in the GHC.Prim interface.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generate the contents of the GHC.Prim interface file automatically
from the list of available PrimOps and various other wired-in things.
Two main benefits from this:
- There's one fewer places to edit when adding a new primop.
- It's one less reason to need the interface file parser, and
now we no longer need the (short-lived) --compile-iface option
so I've removed it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Binary Interface Files - stage 1
--------------------------------
This commit changes the default interface file format from text to
binary, in order to improve compilation performace.
To view an interface file, use 'ghc --show-iface Foo.hi'.
utils/Binary.hs is the basic Binary I/O library, based on the nhc98
binary I/O library but much stripped-down and working in terms of
bytes rather than bits, and with some special features for GHC: it
remembers which Module is being emitted to avoid dumping too many
qualified names, and it keeps track of a "dictionary" of FastStrings
so that we don't dump the same FastString more than once into the
binary file. I'll make a generic version of this for the libraries at
some point.
main/BinIface.hs contains most of the Binary instances. Some
instances are in the same module as the data type (RdrName, Name,
OccName in particular). Most instances were generated using a
modified version of DrIFT, which I'll commit later. However, editing
them by hand isn't hard (certainly easier than modifying
ParseIface.y).
The first thing in a binary interface is the interface version, so
nice error messages will be generated if the binary format changes and
you still have old interfaces lying around. The version also now
includes the "way" as an extra sanity check.
Other changes
-------------
I don't like the way FastStrings contain both hashed strings (with
O(1) comparison) and literal C strings (with O(n) comparison). So as
a first step to separating these I made serveral "literal" type
strings into hashed strings. SLIT() still generates a literal, and
now FSLIT() generates a hashed string. With DEBUG on, you'll get a
warning if you try to compare any SLIT()s with anything, and the
compiler will fall over if you try to dump any literal C strings into
an interface file (usually indicating a use of SLIT() which should be
FSLIT()).
mkSysLocal no longer re-encodes its FastString argument each time it
is called.
I also fixed the -pgm options so that the argument can now optionally
be separted from the option.
Bugfix: PrelNames declared Names for several comparison primops, eg.
eqCharName, eqIntName etc. but these had different uniques from the
real primop names. I've moved these to PrimOps and defined them using
mkPrimOpIdName instead, and deleted some for which we don't have real
primops (Manuel: please check that things still work for you after
this change).
|
|
|
|
| |
Imports only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Simplify the package story inside the compiler. The new story is
this:
The Finder no longer determines a module's package based on its
filesystem location. The filesystem location indicates only whether
a given module is in the current package or not (i.e. found along
the -i path ==> current package, found along the package path ==>
other package).
Hence a Module no longer contains a package name. Instead it just
contains PackageInfo, which is either ThisPackage or AnotherPackage.
The compiler uses this information for generating cross-DLL calls
and omitting certain version information from .hi files.
The interface still contains the package name. This isn't used for
anything right now, but in the future (when we have hierarchical
libraries) we might use it to automatically determine which packages
a binary should be linked against. When building a package, you
should still use -package-name, but it won't be fatal if you don't.
The warning/error about package name mismatches has gone away.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------------------
More jiggling in the renamer
----------------------------
I was a little hasty before. (Thanks Sigbjorn for finding
this.) This commit tidies up the handling of AvailEnvs.
Principally:
* filterImports now deals completely with hiding
(before it handed off part of the job to mkGlobalRdrEnv)
* The AvailEnv in an ExportAvails does not have class ops and
data constructors in its domain. This makes plusExportAvails
more efficient, but the main thing is that it collects things
up right. (Previously, if we had
import M( C )
import M( op )
then we got an AvailEnv which had C |-> AvailTC C [C]
(no 'op').
* In Rename, we do need a "filled-out" version of the overall
AvailEnv, full_avail_env, which we construct on the spot in 'rename'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------
Fix the instance-decl wart
--------------------------
This commit implements the (proposed) H98 rule for
resolving the class-method name in an instance decl.
module M( C( op1, op2 ) ) where
-- NB: op3 not exported
class C a where
op1, op2, op3 :: a -> a
module N where
import qualified M as P( C )
import qualified M as Q hiding( op2 )
instance P.C Int where
op1 x = x
-- op2, op3 both illegal here
The point is that
a) only methods that can be named are legal
in the instance decl
(so op2, op3 are not legal)
b) but it doesn't matter *how* they can be named
(in this case Q.op1 is in scope, though
the class is called P.C)
The AvailEnv carries the information about what's in scope,
so we now have to carry it around in the monad, so that
instance decl bindings can see it. Quite simple really.
Same deal for export lists. E.g.
module N( P.C( op1 ) ) where
import qualified M as P( C )
import qualified M as Q hiding( op2 )
Actually this is what GHC has always implemented!
|
|
|
|
| |
Make local bindings work on the GHCi command line again.
|
|
|
|
| |
Implement the :info command for GHCi.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we auto-load a module because the user typed a qualified name at
the prompt, we better not auto-load a home interface (because we won't
have the code to go with it).
So, introduce a new constructor in the WhereFrom datatype, namely
ImportByCmdLine for these auto-imports, and make findAndReadIface fail
if it tries to load a home interface by this route.
ToDo: GHCi should *never* demand-load a home interface under any
circumstances, but we don't have an ASSERT for this yet.
|
|
|
|
|
|
|
|
|
|
|
|
| |
-----------------------------
Better filtering for warnings
-----------------------------
* Add Opt_WarnMisc, to enable warnings not otherwise covered by Opt_Warn*
in the renamer
* Add RnMonad.ifOptRn :: DynFlag -> RnM d a -> RnM d ()
and use it many places instead of the clumsy direct code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------------
Import more rules, and fix usage info
-------------------------------------
1. A rule wasn't being slurped in that should have been.
Reason: wordToWord32# was in the 'TypeEnv', because it's a primop,
so the renamer thought it was already slurped in, which is true.
But it forgot to use the TypeEnv as a source of gates when deciding
which rules to pull in. Result: a useful rule for the primop wasn't
making it in. Thanks to Marcin for isolating this one.
2. RnIfaces.recordTypeEnvSlurp (was recordVSlurp) was blindly adding
the name to the iVSlurp set, but the iVSlurp set is supposed to contain
only "big" names (tycons, classes, and Ids that aren't data cons,
class ops etc). We need to get the big name from the thing.
Mildly tiresomely, this means we have to keep the Class inside
the TyCon derived from that class. Hence updates to TyCon and Class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------
First cut at ILX
----------------
This commit puts the ILX .NET code generator into the head.
It's entirely untested, mind you.
Some changes to the Module/Package strutures, mainly of a
naming variety. In particular:
Package ===> PackageConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------
A major hygiene pass
--------------------
1. The main change here is to
Move what was the "IdFlavour" out of IdInfo,
and into the varDetails field of a Var
It was a mess before, because the flavour was a permanent attribute
of an Id, whereas the rest of the IdInfo was ephemeral. It's
all much tidier now.
Main places to look:
Var.lhs Defn of VarDetails
IdInfo.lhs Defn of GlobalIdDetails
The main remaining infelicity is that SpecPragmaIds are right down
in Var.lhs, which seems unduly built-in for such an ephemeral thing.
But that is no worse than before.
2. Tidy up the HscMain story a little. Move mkModDetails from MkIface
into CoreTidy (where it belongs more nicely)
This was partly forced by (1) above, because I didn't want to make
DictFun Ids into a separate kind of Id (which is how it was before).
Not having them separate means we have to keep a list of them right
through, rather than pull them out of the bindings at the end.
3. Add NameEnv as a separate module (to join NameSet).
4. Remove unnecessary {-# SOURCE #-} imports from FieldLabel.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement do-style bindings on the GHCi command line.
The syntax for a command-line is exactly that of a do statement, with
the following meanings:
- `pat <- expr'
performs expr, and binds each of the variables in pat.
- `let pat = expr; ...'
binds each of the variables in pat, doesn't do any evaluation
- `expr'
behaves as `it <- expr' if expr is IO-typed, or `let it = expr'
followed by `print it' otherwise.
|
|
|
|
|
|
|
|
|
| |
Make the GHCi command line behave as if an "import qualified M" was in
force for all M.
The renamer now has a new "mode": CmdLineMode, which changes the
lookup machinery to turn a qualified lookup into an original name
lookup if the qualified name isn't otherwise in scope.
|
|
|
|
| |
Simon's renamer fixes from yesterday.
|
|
|
|
| |
A module's dependencies in its .hi file should not include itself!
|
|
|
|
| |
Some renaming in HscTypes
|
|
|
|
| |
Tidy up the Persistent Renamer State structure a little
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main thing in this commit is to change StgAlts so that
it carries a TyCon, and not a Type. Furthermore, the TyCon
is derived from the alternatives, so it should have its
constructors etc, even if there's a module loop involved, so that
some versions of the TyCon don't have the constructors visible.
There's a comment in StgSyn.lhs, with the type decl for StgAlts
Also: a start on hscExpr in HscMain.
|
|
|
|
| |
Compiles now
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Outputable.PprStyle now carries a bit more information
In particular, the printing style tells whether to print
a name in unqualified form. This used to be embedded in
a Name, but since Names now outlive a single compilation unit,
that's no longer appropriate.
So now the print-unqualified predicate is passed in the printing
style, not embedded in the Name.
2. I tidied up HscMain a little. Many of the showPass messages
have migraged into the repective pass drivers
|
|
|
|
| |
Make data constructors visible in unfoldings
|
|
|
|
| |
Compiles most of the Prelude; versioning still not good
|
|
|
|
| |
More small changes
|
|
|
|
| |
More renamer... not in a working state I fear
|
|
|
|
| |
Improve MkIface; get ready for NameEnv.lhs
|
|
|
|
| |
More tidying up; esp of isLocallyDefined
|
|
|
|
|
| |
Move readIface from RnM to IO, and commensurate changes. Also, add a
field to ModuleLocation to hold preprocessed source locations.
|
|
|
|
| |
Renamer tidying up
|
|
|
|
|
| |
Track changes to the finder (now is a global variable and not passed
around). Also some fixes to flag handling.
|
|
|
|
| |
Tons of stuff for the mornings work
|
|
|
|
| |
More renamer
|
|
|
|
| |
Wibbles
|
|
|
|
| |
Make the back-end world compile.
|
|
|
|
| |
Mainly MkIface
|
|
|
|
| |
More renamer stuff
|
|
|
|
| |
Small cleanups.
|
|
|
|
| |
Mainly renamer
|
|
|
|
| |
Latest hacks.
|
|
|
|
| |
Stagger dazedly towards getting the renamer to compile.
|
|
|
|
| |
Make RnEnv compile.
|
|
|
|
|
|
|
| |
Flags hacking:
- `dopt_GlasgowExts' is now written `dopt Opt_GlasgowExts'
- convert all the warning options into DynFlags
|
|
|
|
| |
CmFind ==> Finder
|
|
|
|
| |
make HscTypes and RnMonad compilable
|