| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------
Reorganisation of hi-boot files
------------------------
The main point of this commit is to arrange that in the Compilation
Manager's dependendency graph, hi-boot files are proper nodes. This
is important to make sure that we compile everything in the right
order. It's a step towards hs-boot files.
* The fundamental change is that CompManager.ModSummary has a new
field, ms_boot :: IsBootInterface
I also tided up CompManager a bit. No change to the Basic Plan.
ModSummary is now exported abstractly from CompManager (was concrete)
* Hi-boot files now have import declarations. The idea is they are
compulsory, so that the dependency analyser can find them
* I changed an invariant: the Compilation Manager used to ensure that
hscMain was given a HomePackageTable only for the modules 'below' the
one being compiled. This was really only important for instances and
rules, and it was a bit inconvenient. So I moved the filter to the
compiler itself: see HscTypes.hptInstances and hptRules.
* Module Packages.hs now defines
data PackageIdH
= HomePackage -- The "home" package is the package
-- curently being compiled
| ExtPackage PackageId -- An "external" package is any other package
It was just a Maybe type before, so this makes it a bit clearer.
* I tried to add a bit better location info to the IfM monad, so that
errors in interfaces come with a slightly more helpful error message.
See the if_loc field in TcRnTypes --- and follow-on consequences
* Changed Either to Maybes.MaybeErr in a couple of places (more perspicuous)
|
|
|
|
|
|
|
| |
hGetStringBuffer: hClose the file after we've read it (duh). This
causes a real problem on Windows, where the file remains locked in
GHCi, and cannot be modified until after the finalizer has closed it
(bug #1047408).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------------------------------
New Core invariant: keep case alternatives in sorted order
----------------------------------------
We now keep the alternatives of a Case in the Core language in sorted
order. Sorted, that is,
by constructor tag for DataAlt
by literal for LitAlt
The main reason is that it makes matching and equality testing more robust.
But in fact some lines of code vanished from SimplUtils.mkAlts.
WARNING: no change to interface file formats, but you'll need to recompile
your libraries so that they generate interface files that respect the
invariant.
|
|
|
|
| |
Another wibble to the Panic change; this time on Windows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------
Deal properly with dual-renaming
--------------------------------
When comparing types and terms, and during matching, we are faced
with
\x.e1 ~ \y.e2
There are many pitfalls here, and GHC has never done the job properly.
Now, at last it does, using a new abstraction VarEnv.RnEnv2. See
comments there for how it works.
There are lots of consequential changes to use the new stuff, especially
in
types/Type (type comparison),
types/Unify (matching on types)
coreSyn/CoreUtils (equality on expressions),
specialise/Rules (matching).
I'm not 100% certain of that I've covered all the bases, so let me
know if something unexpected happens after you update. Maybe wait until
a nightly build has worked ok first!
|
|
|
|
| |
Fix breakage in previous commit re signal handling
|
|
|
|
| |
Add comment about Ctrl-C/Ctrl-Break issue
|
|
|
|
|
|
|
|
|
|
|
| |
Support for Ctrl-C on Windows.
This works fine in a cmd.exe shell, but in a Cygwin bash shell you
have to press Ctrl-Break to get an interrupt. There appears to be a
long thread on the cygwin mailing list back in 2002 about this, but
life is probably too short to investigate further.
http://www.cygwin.com/ml/cygwin/2002-01/msg00163.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Further integration with the new package story. GHC now supports
pretty much everything in the package proposal.
- GHC now works in terms of PackageIds (<pkg>-<version>) rather than
just package names. You can still specify package names without
versions on the command line, as long as the name is unambiguous.
- GHC understands hidden/exposed modules in a package, and will refuse
to import a hidden module. Also, the hidden/eposed status of packages
is taken into account.
- I had to remove the old package syntax from ghc-pkg, backwards
compatibility isn't really practical.
- All the package.conf.in files have been rewritten in the new syntax,
and contain a complete list of modules in the package. I've set all
the versions to 1.0 for now - please check your package(s) and fix the
version number & other info appropriately.
- New options:
-hide-package P sets the expose flag on package P to False
-ignore-package P unregisters P for this compilation
For comparison, -package P sets the expose flag on package P
to True, and also causes P to be linked in eagerly.
-package-name is no longer officially supported. Unofficially, it's
a synonym for -ignore-package, which has more or less the same effect
as -package-name used to.
Note that a package may be hidden and yet still be linked into
the program, by virtue of being a dependency of some other package.
To completely remove a package from the compiler's internal database,
use -ignore-package.
The compiler will complain if any two packages in the
transitive closure of exposed packages contain the same
module.
You *must* use -ignore-package P when compiling modules for
package P, if package P (or an older version of P) is already
registered. The compiler will helpfully complain if you don't.
The fptools build system does this.
- Note: the Cabal library won't work yet. It still thinks GHC uses
the old package config syntax.
Internal changes/cleanups:
- The ModuleName type has gone away. Modules are now just (a
newtype of) FastStrings, and don't contain any package information.
All the package-related knowledge is in DynFlags, which is passed
down to where it is needed.
- DynFlags manipulation has been cleaned up somewhat: there are no
global variables holding DynFlags any more, instead the DynFlags
are passed around properly.
- There are a few less global variables in GHC. Lots more are
scheduled for removal.
- -i is now a dynamic flag, as are all the package-related flags (but
using them in {-# OPTIONS #-} is Officially Not Recommended).
- make -j now appears to work under fptools/libraries/. Probably
wouldn't take much to get it working for a whole build.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------
Simplify the treatment of newtypes
Complete hi-boot file consistency checking
------------------------------------
In the representation of types, newtypes used to have a special constructor
all to themselves, very like TyConApp, called NewTcApp. The trouble is
that means we have to *know* when a newtype is a newtype, and in an hi-boot
context we may not -- the data type might be declared as
data T
in the hi-boot file, but as
newtype T = ...
in the source file. In GHCi, which accumulates stuff from multiple compiles,
this makes a difference.
So I've nuked NewTcApp. Newtypes are represented using TyConApps again. This
turned out to reduce the total amount of code, and simplify the Type data type,
which is all to the good.
This commit also fixes a few things in the hi-boot consistency checking
stuff.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------
Add Generalised Algebraic Data Types
------------------------------------
This rather big commit adds support for GADTs. For example,
data Term a where
Lit :: Int -> Term Int
App :: Term (a->b) -> Term a -> Term b
If :: Term Bool -> Term a -> Term a
..etc..
eval :: Term a -> a
eval (Lit i) = i
eval (App a b) = eval a (eval b)
eval (If p q r) | eval p = eval q
| otherwise = eval r
Lots and lots of of related changes throughout the compiler to make
this fit nicely.
One important change, only loosely related to GADTs, is that skolem
constants in the typechecker are genuinely immutable and constant, so
we often get better error messages from the type checker. See
TcType.TcTyVarDetails.
There's a new module types/Unify.lhs, which has purely-functional
unification and matching for Type. This is used both in the typechecker
(for type refinement of GADTs) and in Core Lint (also for type refinement).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------
Use merge-sort not quicksort
Nuke quicksort altogether
-------------------------------
Quicksort has O(n**2) behaviour worst case, and this occasionally bites.
In particular, when compiling large files consisting only of static data,
we get loads of top-level delarations -- and that led to more than half the
total compile time being spent in the strongly connected component analysis
for the occurrence analyser. Switching to merge sort completely solved the
problem.
I've nuked quicksort altogether to make sure this does not happen again.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------
Add instance information to :i
Get rid of the DeclPool
-------------------------------
1. Add instance information to :info command. GHCi now prints out
which instances a type or class belongs to, when you use :i
2. Tidy up printing of unqualified names in user output.
Previously Outputable.PrintUnqualified was
type PrintUnqualified = Name -> Bool
but it's now
type PrintUnqualified = ModuleName -> OccName -> Bool
This turns out to be tidier even for Names, and it's now also usable
when printing IfaceSyn stuff in GHCi, eliminating a grevious hack.
3. On the way to doing this, Simon M had the great idea that we could
get rid of the DeclPool holding pen, which held declarations read from
interface files but not yet type-checked. We do this by eagerly
populating the TypeEnv with thunks what, when poked, do the type
checking. This is just a logical continuation of lazy import
mechanism we've now had for some while.
The InstPool and RulePool still exist, but I plan to get rid of them in
the same way. The new scheme does mean that more rules get sucked in than
before, because previously the TypeEnv was used to mean "this thing was needed"
and hence to control which rules were sucked in. But now the TypeEnv is
populated more eagerly => more rules get sucked in. However this problem
will go away when I get rid of the Inst and Rule pools.
I should have kept these changes separate, but I didn't. Change (1)
affects mainly
TcRnDriver, HscMain, CompMan, InteractiveUI
whereas change (3) is more wide ranging.
|
|
|
|
| |
Merge backend-hacking-branch onto HEAD. Yay!
|
|
|
|
|
|
| |
Version 6.3 is encoded as 603 not 630.
GHC builds fine again through both stages on my system.
Ralf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Boot-strapping ghc revealed an issue related to yesterday's renaming
of Data.Typeable. I can now build a stage1 compiler again. Let me try
a stage2 one as well.
ralf 2004/03/21 11:06:04 PST
Modified files:
ghc/compiler/prelude PrelNames.lhs
ghc/compiler/typecheck TcGenDeriv.lhs
Log:
Implemented renaming for Data.Typeable
as far as deriving mechanism is involved.
See http://www.haskell.org//pipermail/libraries/2004-March/001846.html
Revision Changes Path
1.88 +1 -1 fptools/ghc/compiler/prelude/PrelNames.lhs
1.107 +1 -1 fptools/ghc/compiler/typecheck/TcGenDeriv.lhs
|
|
|
|
| |
Better layout in interppSP
|
|
|
|
| |
Don't call hGetArray with a size of zero (fixes read021).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
---------------------------------------
Record dependency on Template Haskell package
---------------------------------------
An unforseen consequence of making the Template Haskell package separate
is that we need to record dependency on the package, even if no TH module
is imported. So we carry round (another) mutable variable tcg_th_used in
the tyepchecker monad, and zap it when $(...) and [| ... |] are used.
I did a little tidy-up and documentation in ListSetOps too
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some small steps in the direction of making GHC useable as a library:
- The ErrMsg type is now richer: we keep the location info and the
PrintUnqualified separate until the message is printed out, and
messages have a short summary and "extra info", where the extra
info is used for things like the context info in the typechecker
(stuff that you don't normally want to see in a more visual setting,
where the context is obvious because you're looking at the code).
- hscMain now takes an extra argument of type (Messages -> IO ()),
which says what to do with the error messages. In normal usage,
we just pass ErrUtils.printErrorsAndWarnings, but eg. a development
environment will want to do something different. The direction we
need to head in is for hscMain to *never* do any output to
stdout/stderr except via abstractions like this.
|
|
|
|
| |
Wibble to kind inference; add zipWithM, zipWithM_ and use them
|
|
|
|
| |
Import trimming
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add accurate source location annotations to HsSyn
-------------------------------------------------
Every syntactic entity in HsSyn is now annotated with a SrcSpan, which
details the exact beginning and end points of that entity in the
original source file. All honest compilers should do this, and it was
about time GHC did the right thing.
The most obvious benefit is that we now have much more accurate error
messages; when running GHC inside emacs for example, the cursor will
jump to the exact location of an error, not just a line somewhere
nearby. We haven't put a huge amount of effort into making sure all
the error messages are accurate yet, so there could be some tweaking
still needed, although the majority of messages I've seen have been
spot-on.
Error messages now contain a column number in addition to the line
number, eg.
read001.hs:25:10: Variable not in scope: `+#'
To get the full text span info, use the new option -ferror-spans. eg.
read001.hs:25:10-11: Variable not in scope: `+#'
I'm not sure whether we should do this by default. Emacs won't
understand the new error format, for one thing.
In a more elaborate editor setting (eg. Visual Studio), we can arrange
to actually highlight the subexpression containing an error. Eventually
this information will be used so we can find elements in the abstract
syntax corresponding to text locations, for performing high-level editor
functions (eg. "tell me the type of this expression I just highlighted").
Performance of the compiler doesn't seem to be adversely affected.
Parsing is still quicker than in 6.0.1, for example.
Implementation:
This was an excrutiatingly painful change to make: both Simon P.J. and
myself have been working on it for the last three weeks or so. The
basic changes are:
- a new datatype SrcSpan, which represents a beginning and end position
in a source file.
- To reduce the pain as much as possible, we also defined:
data Located e = L SrcSpan e
- Every datatype in HsSyn has an equivalent Located version. eg.
type LHsExpr id = Located (HsExpr id)
and pretty much everywhere we used to use HsExpr we now use
LHsExpr. Believe me, we thought about this long and hard, and
all the other options were worse :-)
Additional changes/cleanups we made at the same time:
- The abstract syntax for bindings is now less arcane. MonoBinds
and HsBinds with their built-in list constructors have gone away,
replaced by HsBindGroup and HsBind (see HsSyn/HsBinds.lhs).
- The various HsSyn type synonyms have now gone away (eg. RdrNameHsExpr,
RenamedHsExpr, and TypecheckedHsExpr are now HsExpr RdrName,
HsExpr Name, and HsExpr Id respectively).
- Utilities over HsSyn are now collected in a new module HsUtils.
More stuff still needs to be moved in here.
- MachChar now has a real Char instead of an Int. All GHC versions that
can compile GHC now support 32-bit Chars, so this was a simplification.
|
|
|
|
|
|
| |
GC some dead code. In some places, I left useful-looking but
currently unused definitions in place, surrounded by #ifdef UNUSED
... #endif.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------
Major increment for Template Haskell
------------------------------------
1. New abstract data type "Name" which appears where String used to be.
E.g. data Exp = VarE Name | ...
2. New syntax 'x and ''T, for quoting Names. It's rather like [| x |]
and [t| T |] respectively, except that
a) it's non-monadic: 'x :: Name
b) you get a Name not an Exp or Type
3. reify is an ordinary function
reify :: Name -> Q Info
New data type Info which tells what TH knows about Name
4. Local variables work properly. So this works now (crashed before):
f x = $( [| x |] )
5. THSyntax is split up into three modules:
Language.Haskell.TH TH "clients" import this
Language.Haskell.TH.THSyntax data type declarations and internal stuff
Language.Haskell.TH.THLib Support library code (all re-exported
by TH), including smart constructors and
pretty printer
6. Error reporting and recovery are in (not yet well tested)
report :: Bool {- True <=> fatal -} -> String -> Q ()
recover :: Q a -> Q a -> Q a
7. Can find current module
currentModule :: Q String
Much other cleaning up, needless to say.
|
|
|
|
| |
Always qualify in defaultErrStyle
|
|
|
|
| |
Add these two files to the preceding mega-commit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------
GHC heart/lung transplant
-------------------------
This major commit changes the way that GHC deals with importing
types and functions defined in other modules, during renaming and
typechecking. On the way I've changed or cleaned up numerous other
things, including many that I probably fail to mention here.
Major benefit: GHC should suck in many fewer interface files when
compiling (esp with -O). (You can see this with -ddump-rn-stats.)
It's also some 1500 lines of code shorter than before.
** So expect bugs! I can do a 3-stage bootstrap, and run
** the test suite, but you may be doing stuff I havn't tested.
** Don't update if you are relying on a working HEAD.
In particular, (a) External Core and (b) GHCi are very little tested.
But please, please DO test this version!
------------------------
Big things
------------------------
Interface files, version control, and importing declarations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* There is a totally new data type for stuff that lives in interface files:
Original names IfaceType.IfaceExtName
Types IfaceType.IfaceType
Declarations (type,class,id) IfaceSyn.IfaceDecl
Unfoldings IfaceSyn.IfaceExpr
(Previously we used HsSyn for type/class decls, and UfExpr for unfoldings.)
The new data types are in iface/IfaceType and iface/IfaceSyn. They are
all instances of Binary, so they can be written into interface files.
Previous engronkulation concering the binary instance of RdrName has
gone away -- RdrName is not an instance of Binary any more. Nor does
Binary.lhs need to know about the ``current module'' which it used to,
which made it specialised to GHC.
A good feature of this is that the type checker for source code doesn't
need to worry about the possibility that we might be typechecking interface
file stuff. Nor does it need to do renaming; we can typecheck direct from
IfaceSyn, saving a whole pass (module TcIface)
* Stuff from interface files is sucked in *lazily*, rather than being eagerly
sucked in by the renamer. Instead, we use unsafeInterleaveIO to capture
a thunk for the unfolding of an imported function (say). If that unfolding
is every pulled on, TcIface will scramble over the unfolding, which may
in turn pull in the interface files of things mentioned in the unfolding.
The External Package State is held in a mutable variable so that it
can be side-effected by this lazy-sucking-in process (which may happen
way later, e.g. when the simplifier runs). In effect, the EPS is a kind
of lazy memo table, filled in as we suck things in. Or you could think
of it as a global symbol table, populated on demand.
* This lazy sucking is very cool, but it can lead to truly awful bugs. The
intent is that updates to the symbol table happen atomically, but very bad
things happen if you read the variable for the table, and then force a
thunk which updates the table. Updates can get lost that way. I regret
this subtlety.
One example of the way it showed up is that the top level of TidyPgm
(which updates the global name cache) to be much more disciplined about
those updates, since TidyPgm may itself force thunks which allocate new
names.
* Version numbering in interface files has changed completely, fixing
one major bug with ghc --make. Previously, the version of A.f changed
only if A.f's type and unfolding was textually different. That missed
changes to things that A.f's unfolding mentions; which was fixed by
eagerly sucking in all of those things, and listing them in the module's
usage list. But that didn't work with --make, because they might have
been already sucked in.
Now, A.f's version changes if anything reachable from A.f (via interface
files) changes. A module with unchanged source code needs recompiling
only if the versions of any of its free variables changes. [This isn't
quite right for dictionary functions and rules, which aren't mentioned
explicitly in the source. There are extensive comments in module MkIface,
where all version-handling stuff is done.]
* We don't need equality on HsDecls any more (because they aren't used in
interface files). Instead we have a specialised equality for IfaceSyn
(eqIfDecl etc), which uses IfaceEq instead of Bool as its result type.
See notes in IfaceSyn.
* The horrid bit of the renamer that tried to predict what instance decls
would be needed has gone entirely. Instead, the type checker simply
sucks in whatever instance decls it needs, when it needs them. Easy!
Similarly, no need for 'implicitModuleFVs' and 'implicitTemplateHaskellFVs'
etc. Hooray!
Types and type checking
~~~~~~~~~~~~~~~~~~~~~~~
* Kind-checking of types is far far tidier (new module TcHsTypes replaces
the badly-named TcMonoType). Strangely, this was one of my
original goals, because the kind check for types is the Right Place to
do type splicing, but it just didn't fit there before.
* There's a new representation for newtypes in TypeRep.lhs. Previously
they were represented using "SourceTypes" which was a funny compromise.
Now they have their own constructor in the Type datatype. SourceType
has turned back into PredType, which is what it used to be.
* Instance decl overlap checking done lazily. Consider
instance C Int b
instance C a Int
These were rejected before as overlapping, because when seeking
(C Int Int) one couldn't tell which to use. But there's no problem when
seeking (C Bool Int); it can only be the second.
So instead of checking for overlap when adding a new instance declaration,
we check for overlap when looking up an Inst. If we find more than one
matching instance, we see if any of the candidates dominates the others
(in the sense of being a substitution instance of all the others);
and only if not do we report an error.
------------------------
Medium things
------------------------
* The TcRn monad is generalised a bit further. It's now based on utils/IOEnv.lhs,
the IO monad with an environment. The desugarer uses the monad too,
so that anything it needs can get faulted in nicely.
* Reduce the number of wired-in things; in particular Word and Integer
are no longer wired in. The latter required HsLit.HsInteger to get a
Type argument. The 'derivable type classes' data types (:+:, :*: etc)
are not wired in any more either (see stuff about derivable type classes
below).
* The PersistentComilerState is now held in a mutable variable
in the HscEnv. Previously (a) it was passed to and then returned by
many top-level functions, which was painful; (b) it was invariably
accompanied by the HscEnv. This change tidies up top-level plumbing
without changing anything important.
* Derivable type classes are treated much more like 'deriving' clauses.
Previously, the Ids for the to/from functions lived inside the TyCon,
but now the TyCon simply records their existence (with a simple boolean).
Anyone who wants to use them must look them up in the environment.
This in turn makes it easy to generate the to/from functions (done
in types/Generics) using HsSyn (like TcGenDeriv for ordinary derivings)
instead of CoreSyn, which in turn means that (a) we don't have to figure
out all the type arguments etc; and (b) it'll be type-checked for us.
Generally, the task of generating the code has become easier, which is
good for Manuel, who wants to make it more sophisticated.
* A Name now says what its "parent" is. For example, the parent of a data
constructor is its type constructor; the parent of a class op is its
class. This relationship corresponds exactly to the Avail data type;
there may be other places we can exploit it. (I made the change so that
version comparison in interface files would be a bit easier; but in
fact it tided up other things here and there (see calls to
Name.nameParent). For example, the declaration pool, of declararations
read from interface files, but not yet used, is now keyed only by the 'main'
name of the declaration, not the subordinate names.
* New types OccEnv and OccSet, with the usual operations.
OccNames can be efficiently compared, because they have uniques, thanks
to the hashing implementation of FastStrings.
* The GlobalRdrEnv is now keyed by OccName rather than RdrName. Not only
does this halve the size of the env (because we don't need both qualified
and unqualified versions in the env), but it's also more efficient because
we can use a UniqFM instead of a FiniteMap.
Consequential changes to Provenance, which has moved to RdrName.
* External Core remains a bit of a hack, as it was before, done with a mixture
of HsDecls (so that recursiveness and argument variance is still inferred),
and IfaceExprs (for value declarations). It's not thoroughly tested.
------------------------
Minor things
------------------------
* DataCon fields dcWorkId, dcWrapId combined into a single field
dcIds, that is explicit about whether the data con is a newtype or not.
MkId.mkDataConWorkId and mkDataConWrapId are similarly combined into
MkId.mkDataConIds
* Choosing the boxing strategy is done for *source* type decls only, and
hence is now in TcTyDecls, not DataCon.
* WiredIn names are distinguished by their n_sort field, not by their location,
which was rather strange
* Define Maybes.mapCatMaybes :: (a -> Maybe b) -> [a] -> [b]
and use it here and there
* Much better pretty-printing of interface files (--show-iface)
Many, many other small things.
------------------------
File changes
------------------------
* New iface/ subdirectory
* Much of RnEnv has moved to iface/IfaceEnv
* MkIface and BinIface have moved from main/ to iface/
* types/Variance has been absorbed into typecheck/TcTyDecls
* RnHiFiles and RnIfaces have vanished entirely. Their
work is done by iface/LoadIface
* hsSyn/HsCore has gone, replaced by iface/IfaceSyn
* typecheck/TcIfaceSig has gone, replaced by iface/TcIface
* typecheck/TcMonoType has been renamed to typecheck/TcHsType
* basicTypes/Var.hi-boot and basicTypes/Generics.hi-boot have gone altogether
|
|
|
|
| |
hGetStringBuffer: open file in binary mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the handwritten lexer with one generated by Alex.
YOU NOW NEED ALEX (v 2.0 or later) TO COMPILE GHC FROM CVS.
Highlights:
- Faster than the previous lexer (about 10% of total parse time,
depending on the token mix).
- More correct than the previous lexer: a couple of minor wibbles
in the syntax were fixed.
- Completely accurate source spans for each token are now collected.
This information isn't used yet, but it will be used to give much
more accurate error messages in the future.
- SrcLoc now contains a column field as well as a line number,
although this is currently ignored when printing out SrcLocs.
- StringBuffer is now based on a ByteArray# rather than a Ptr, which
means that StringBuffers are now garbage collected. Previously
StringBuffers were hardly ever released, so a GHCi session would
leak space as more source files were loaded in.
- Code size reduction: Lexer.x is about the same size as the old
Lex.lhs, but StringBuffer.lhs is significantly shorter and
simpler. Sadly I wasn't able to get rid of parser/Ctypes.hs
(yet).
|
|
|
|
|
| |
Define maybePrefixMatch, which is like prefixMatch but returns the
rest of the String after the match.
|
|
|
|
|
| |
Fix bug in hashSubStringBA, which it appears has been broken for
ever. However, I suspect so far we've never tickled the bug in GHC.
|
|
|
|
| |
Fix up compilation with GHC 5.02
|
|
|
|
| |
Fix another occurence of openFileEx in stage2
|
|
|
|
| |
openFileEx can't be gotten from GHC.Handle any more.
|
|
|
|
| |
fix more gcc 3.3 preprocessor warnings
|
|
|
|
|
| |
change trailing comments on #else/#endif lines to C style to avoid
warnings from gcc 3.3's preprocessor.
|
|
|
|
| |
Comment only
|
|
|
|
| |
Fix compilation problem on mingw32
|
|
|
|
| |
Fix compilation breakage with GHC 4.08.x.
|
|
|
|
|
|
|
|
|
|
|
| |
Three Template Haskell improvements
a) Add type synonyms to THSyntax (and DsMeta, Convert)
b) Make Q into a newtype instead of a type synonym
c) Eliminate tiresome and error prone argument to DsMeta.wrapGenSyms
and similarly addTyVarBinds
|
|
|
|
| |
More tidy up
|
|
|
|
| |
deja vu all over again
|
|
|
|
| |
Fix build on GHC < 5.00
|
|
|
|
|
| |
Restore interrupt/quit signal handlers after every evaluation in GHCi,
just in case the program set its own.
|
|
|
|
|
|
|
|
| |
Be sensitive to filenames containing spaces when processing
:load & :add commands. Ditto when interpreting filenames given
on GHCi's cmd-line.
Merge to STABLE.
|
|
|
|
|
|
|
|
| |
Further refine the criteria for deciding whether command line
arguments should be passed to the compilation manager or the linker.
See comments in the file.
MERGE TO STABLE
|
|
|
|
| |
On second thoughts, use memcmp instead.
|
|
|
|
|
| |
Oops, cmpFS uses strcmp() to compare strings, so it has a '\0'
terminator requirement. Fix it to use strncmp() instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix recent breakage on the HEAD. This was caused by the fix to
Lex.lhs to treat primitive strings as "narrow" FastStrings in all
cases, rather than Unicode ("wide") FastStrings if the string
contained a '\0'. The problem is that narrow FastStrings aren't set
up to handle strings containing '\0'. They used to be, but it got
broken somewhere along the line.
This commit:
- remove the '\0' test from unpackCStringBA (it takes a length
argument anyway), and rename it to unpackNBytesBA. This fixes
the bug.
- remove the '\0' terminator from all strings generated by the
functions in PrimPacked. The terminators aren't required,
as far as I can tell. This should have a tiny but positive
effect on compile times.
MERGE TO STABLE
|