| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
--------------------------
Minor Template Haskell bug
--------------------------
This bug meant that spliced-in class declarations yielded a 'op not in scope',
where op was the class operation. Thanks to Andre Pang for spotting this.
Some consequential tidying up in parsing too.
|
|
|
|
| |
Formatting only
|
|
|
|
| |
Add support for unboxed Ints, Floats and Doubles to Template Haskell.
|
|
|
|
| |
Unbreak 2nd stage
|
|
|
|
|
|
|
|
| |
Order declarations in reifications in order of source line number.
The bugs still there but it bites less often now...
Also remove the type parameterisation and do some type renaming as
discussed on the template-haskell list.
|
|
|
|
| |
comments
|
|
|
|
| |
Support for contexts on data types and records from Derek Elkins.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------------
Improve the "unused binding" warnings
-------------------------------------
We've had a succession of hacks for reporting warnings for
unused bindings. Consider
module M( f ) where
f x = x
g x = g x + h x
h x = x
Here, g mentions itself and h, but is not itself mentioned. So
really both g and h are dead code. We've been getting this wrong
for ages, and every hack so far has failed on some simple programs.
This commit does a much better job. The renamer applied to a bunch
of bindings returns a NameSet.DefUses, which is a dependency-ordered
lists of def/use pairs. It's documented in NameSet.
Given this, we can work out precisely what is not used, in a nice
tidy way.
It's less convenient in the case of type and class declarations, because
the strongly-connected-component analysis can span module boundaries.
So things are pretty much as they were for these.
As usual, there was a lot of chuffing around tidying things up.
I havn't tested it at all thoroughly yet.
Various unrelated import-decl-pruning has been done too.
|
|
|
|
| |
Import pruning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------------
Add Core Notes and the {-# CORE #-} pragma
-------------------------------------
This is an idea of Hal Daume's. The key point is that Notes in Core
are augmented thus:
data Note
= SCC CostCentre
| ...
| CoreNote String -- NEW
These notes can be injected via a Haskell-source pragma:
f x = ({-# CORE "foo" #-} show) ({-# CORE "bar" #-} x)
This wraps a (Note (CoreNote "foo")) around the 'show' variable,
and a similar note around the argument to 'show'.
These notes are basically ignored by GHC, but are emitted into
External Core, where they may convey useful information.
Exactly how code involving these notes is munged by the simplifier
isn't very well defined. We'll see how it pans out. Meanwhile
the impact on the rest of the compiler is minimal.
|
|
|
|
| |
Import pruning
|
|
|
|
|
| |
Support strictness annotations on data declarations and support the record
and infix constructors. Also tweaked the pretty printer a bit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------------
Big upheaval to the way that constructors are named
-------------------------------------
This commit enshrines the new story for constructor names. We could never
really get External Core to work nicely before, but now it does.
The story is laid out in detail in the Commentary
ghc/docs/comm/the-beast/data-types.html
so I will not repeat it here.
[Manuel: the commentary isn't being updated, apparently.]
However, the net effect is that in Core and in External Core, contructors look
like constructors, and the way things are printed is all consistent.
It is a fairly pervasive change (which is why it has been so long postponed),
but I hope the question is now finally closed.
All the libraries compile etc, and I've run many tests, but doubtless there will
be some dark corners.
|
|
|
|
| |
Deal with TForall in cvtType
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------------
Fix parsing of floating-point constants in External Core
-------------------------------------
This fix accidentally made it into the previous (unrelated) commit,
so it's really the *previous* change to LexCore you should look
at.
The fix updates LexCore so that it can parse literals in scientific
notation (e.g. 4.3e-3)
|
|
|
|
| |
Type sigs and comments only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------------
Remove all vestiges of usage analysis
-------------------------------------
This commit removes a large blob of usage-analysis-related code, almost
all of which was commented out.
Sadly, it doesn't look as if Keith is going to have enough time to polish it
up, and in any case the actual performance benefits (so far as we can measure
them) turned out to be pretty modest (a few percent).
So, with regret, I'm chopping it all out. It's still there in the repository
if anyone wants go hack on it. And Tobias Gedell at Chalmers is implementing
a different analysis, via External Core.
|
|
|
|
| |
Context predicates start with a tcon name, not a type variable
|
|
|
|
| |
Convert Tup [e] and Pat [p] and e, p respectively.
|
|
|
|
| |
Handle bindings to just a pattern variable in cvtd.
|
|
|
|
| |
Improved foreign import conversion.
|
|
|
|
| |
Use real datatypes for TH Clause and Match
|
|
|
|
|
| |
Correctly convert expressions from TH datastructures to the internel Hs*
datastructures containing right infix operators left-parenthesised.
|
|
|
|
| |
More wibbles to improve declaration splicing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------------------
Fix and tidy the desugaring of
pattern-matching in do-notation
-------------------------------
In the reorgansiation of HsPat, failureFreePat had become incorrect (due to
a catch-all case that caught a constructor that should have been matched). So
pattern-match failure in do-notation wasn't handled right.
As it turned out, DsExpr.dsDo could be made much simpler and more elegant
by using matchSimply instead of matchWrapper, and this had the side benefit
of removing the last call to HsPat.failureFreePat. So it's gone!
|
|
|
|
|
| |
Convert : Added newly required import of `HsSyn.TySynonym'
TcSplice: Adapted `tcRunQ' to new definition of `THSyntax.Q'
|
|
|
|
|
|
|
|
|
|
|
| |
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 TH stuff (thanks to Ian L)
------------------
* Make TH Literals have an Integer not an Int
* Desguar TH 'foreign import' a bit better
* Minor documentation changes
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------
Template Haskell stuff
------------------
a) Pretty printer for TH (thanks to Ian Lynagh)
b) A declaration quote has type Q [Dec], not [Q Dec] as in
the paper
c) Foreign imports are part of THSyntax, and can be spliced in
|
|
|
|
| |
Finish TH exprs with type sigs
|
|
|
|
| |
Add string/rational literals, and e::t form to TH
|
|
|
|
| |
Remove CrossStage from Convert
|
|
|
|
| |
Import wibbles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------------
1. New try and module and package dependencies
2. OrigNameCache always contains final info
------------------------------------------
These things nearly complete sorting out the incremental
linking problem that started us off!
1. This commit separates two kinds of information:
(a) HscTypes.Dependencies:
What (i) home-package modules, and
(ii) other packages
this module depends on, transitively.
That is, to link the module, it should be enough
to link the dependent modules and packages (plus
any C stubs etc).
Along with this info we record whether the dependent module
is (a) a boot interface or (b) an orphan module. So in
fact (i) can contain non-home-package modules, namely the
orphan ones in other packages (sigh).
(b) HscTypes.Usage:
What version of imported things were used to
actually compile the module. This info is used for
recompilation control only.
2. The Finder now returns a correct Module (incl package indicator)
first time, so we can install the absolutely final Name in the
OrigNameCache when we first come across an occurrence of that name,
even if it's only an occurrence in an unfolding in some other interface
file. This is much tidier.
As a result Module.lhs is much cleaner
No DunnoYet
No mkVanillaModule
ALl very joyful stuff.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------------------
Allow implicit-parameter bindings anywhere that
a normal binding group is allowed.
------------------------------------------------
That is, you can have implicit parameters
* in a let binding
* in a where clause (but then you can't have non-implicit
ones as well)
* in a let group in a list comprehension or monad do-notation
The implementation is simple: just add IPBinds to the allowable forms of HsBinds,
and remove the HsWith expression form altogether. (It now comes in via the
HsLet form.)
It'a a nice generalisation really. Needs a bit of documentation, which I'll do next.
|
|
|
|
| |
More reification wibbling; and -ddump-splices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------------
Implement reification for Template Haskell
------------------------------------------
This is entirely un-tested, but I don't think it'll break non-TH stuff.
Implements
reifyDecl T :: Dec -- Data type T
reifyDecl C :: Dec -- Class C
reifyType f :: Typ -- Function f
I hope.
|
|
|
|
| |
Fix to mdo, plus SrcLocs on splices and brackets
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-----------------------------------
Lots more Template Haskell stuff
-----------------------------------
At last! Top-level declaration splices work!
Syntax is
$(f x)
not "splice (f x)" as in the paper.
Lots jiggling around, particularly with the top-level plumbining.
Note the new data type HsDecls.HsGroup.
|
|
|
|
| |
Wibbles to improve error reporting
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------
Implement recursive do-notation
--------------------------------
This commit adds recursive do-notation, which Hugs has had for some time.
mdo { x <- foo y ;
y <- baz x ;
return (y,x) }
turns into
do { (x,y) <- mfix (\~(x,y) -> do { x <- foo y;
y <- baz x }) ;
return (y,x) }
This is all based on work by Levent Erkok and John Lanuchbury.
The really tricky bit is in the renamer (RnExpr.rnMDoStmts) where
we break things up into minimal segments. The rest is easy, including
the type checker.
Levent laid the groundwork, and Simon finished it off. Needless to say,
I couldn't resist tidying up other stuff, so there's no guaranteed I
have not broken something.
|
|
|
|
| |
wibbles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------
Fix rank-2 pattern-match failure
--------------------------------
This fixes the failure when you have a rank-2 type sig
matching a data type pattern. Thus
data T a = T1 | T2 a
f :: (forall x. T x) -> Int
f T1 = ...
This crashes GHC 5.04
|
|
|
|
|
| |
Fix typo in explanation of "What AbsBinds means" just to prove that I'm
not deadweight on the GHC committers list ;-)
|
|
|
|
| |
Wibble on printing outmost parens
|
|
|
|
| |
Fix HnType parenthesisation; fixes rnfail020, tcfail057
|
|
|
|
| |
Another HsParTy wibble; cures rn018 failure
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed handling of infix operators in types:
- Pretty printing didn't take nested infix operators into account
- Explicit parenthesis were ignored in the fixity parser:
* I added a constructor `HsParTy' to `HsType' (in the spirit of `HsPar' in
`HsExpr'), which tracks the use of explicit parenthesis
* Occurences of `HsParTy' in type-ish things that are not quite types (like
context predicates) are removed in `ParseUtils'; all other occurences of
`HsParTy' are removed during type checking (just as it works with `HsPar')
|
|
|
|
| |
Fix bogon in rebindable syntax implementation
|