| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Lots of refactoring. In particular I have now combined
TansformStmt and GroupStmt into a single constructor TransStmt.
This gives lots of useful code sharing.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
This is the work of Nils Schweinsberg <mail@n-sch.de>
It adds the language extension -XMonadComprehensions, which
generalises list comprehension syntax [ e | x <- xs] to work over
arbitrary monads.
|
|
|
|
|
| |
I don't know why these were left out. I did the obvious
thing... I hope it's right!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the code generator generated small code fragments labelled
with __stginit_M for each module M, and these performed whatever
initialisation was necessary for that module and recursively invoked
the initialisation functions for imported modules. This appraoch had
drawbacks:
- FFI users had to call hs_add_root() to ensure the correct
initialisation routines were called. This is a non-standard,
and ugly, API.
- unless we were using -split-objs, the __stginit dependencies would
entail linking the whole transitive closure of modules imported,
whether they were actually used or not. In an extreme case (#4387,
#4417), a module from GHC might be imported for use in Template
Haskell or an annotation, and that would force the whole of GHC to
be needlessly linked into the final executable.
So now instead we do our initialisation with C functions marked with
__attribute__((constructor)), which are automatically invoked at
program startup time (or DSO load-time). The C initialisers are
emitted into the stub.c file. This means that every time we compile
with -prof or -hpc, we now get a stub file, but thanks to #3687 that
is now invisible to the user.
There are some refactorings in the RTS (particularly for HPC) to
handle the fact that initialisers now get run earlier than they did
before.
The __stginit symbols are still generated, and the hs_add_root()
function still exists (but does nothing), for backwards compatibility.
|
|
|
|
|
|
| |
This fixes a couple of duplicates that had crept in, and also
renumbers everything so that they are monotonically increasing
through the file.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added a pragma {-# VECTORISE var = exp #-} that prevents
the vectoriser from vectorising the definition of 'var'.
Instead it uses the binding '$v_var = exp' to vectorise
'var'. The vectoriser checks that the Core type of 'exp'
matches the vectorised Core type of 'var'. (It would be
quite complicated to perform that check in the type checker
as the vectorisation of a type needs the state of the VM
monad.)
- Added parts of a related VECTORISE SCALAR pragma
- Documented -ddump-vect
- Added -ddump-vt-trace
- Some clean up
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The changes are:
* New flag -fwarn-incomplete-uni-patterns, which checks for
incomplete patterns in (a) lambdas, (b) pattern bindings
* New flag is not implied by -W or -Wall (too noisy; and many
libraries use incomplete pattern bindings)
* Actually do the incomplete-pattern check for pattern bindings
(previously simply omitted)
* Documentation for new flag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes Trac #4875. The main point is to do dependency
analysis on type and class declarations, and kind-check them in
dependency order, so as to improve error messages.
This patch means that a few programs that would typecheck before won't
typecheck any more; but before we were (naughtily) going beyond
Haskell 98 without any language-extension flags, and Trac #4875
convinces me that doing so is a Bad Idea.
Here's an example that won't typecheck any more
data T a b = MkT (a b)
type F k = T k Maybe
If you look at T on its own you'd default 'a' to kind *->*;
and then kind-checking would fail on F.
But GHC currently accepts this program beause it looks at
the *occurrences* of T.
|
|
|
|
|
|
| |
We need the unfolding even for a *recursive* function (indeed
that's the point) and I was using the wrong function to get it
(idUnfolding rather than realIdUnfolding).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For a long time an 'mdo' expression has had a SyntaxTable
attached to it. However, we're busy deprecating SyntaxTables
in favour of rebindable syntax attached to individual Stmts,
and MDoExpr was totally inconsistent with DoExpr in this
regard.
This patch tidies it all up. Now there's no SyntaxTable on
MDoExpr, and 'modo' is generally handled much more like 'do'.
There is resulting small change in behaviour: now MonadFix is
required only if you actually *use* recursion in mdo. This
seems consistent with the implicit dependency analysis that
is done for mdo.
Still to do:
* Deal with #4148 (this patch is on the way)
* Get rid of the last remaining SyntaxTable on HsCmdTop
|
|
|
|
|
|
| |
This clears up an awkward hack for exprIsConApp_maybe, and
works better too. See Note [Single-method classes] in
TcInstDcls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch finally deals with the super-delicate question of
superclases in possibly-recursive dictionaries. The key idea
is the DFun Superclass Invariant (see TcInstDcls):
In the body of a DFun, every superclass argument to the
returned dictionary is
either * one of the arguments of the DFun,
or * constant, bound at top level
To establish the invariant, we add new "silent" superclass
argument(s) to each dfun, so that the dfun does not do superclass
selection internally. There's a bit of hoo-ha to make sure that
we don't print those silent arguments in error messages; a knock
on effect was a change in interface-file format.
A second change is that instead of the complex and fragile
"self dictionary binding" in TcInstDcls and TcClassDcl,
using the same mechanism for existential pattern bindings.
See Note [Subtle interaction of recursion and overlap] in TcInstDcls
and Note [Binding when looking up instances] in InstEnv.
Main notes are here:
* Note [Silent Superclass Arguments] in TcInstDcls,
including the DFun Superclass Invariant
Main code changes are:
* The code for MkId.mkDictFunId and mkDictFunTy
* DFunUnfoldings get a little more complicated;
their arguments are a new type DFunArg (in CoreSyn)
* No "self" argument in tcInstanceMethod
* No special tcSimplifySuperClasss
* No "dependents" argument to EvDFunApp
IMPORTANT
It turns out that it's quite tricky to generate the right
DFunUnfolding for a specialised dfun, when you use SPECIALISE
INSTANCE. For now I've just commented it out (in DsBinds) but
that'll lose some optimisation, and I need to get back to
this.
|
|
|
|
|
|
|
|
| |
The renamer wasn't attaching the right used-variables to a
TransformStmt constructor.
The real modification is in RnExpr; the rest is just
pretty-printing and white space.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
And remove the old mechanism of recording dfun uses separately,
because it didn't work.
This wiki page describes recompilation avoidance and fingerprinting.
I'll update it to describe the new method and what went wrong with the
old method:
http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/RecompilationAvoidance
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the current loop in T3731, and will fix other
reported loops. The loops show up when we are generating
evidence for superclasses in an instance declaration.
The trick is to make the "self" dictionary simplifySuperClass
depend *explicitly* on the superclass we are currently trying
to build. See Note [Dependencies in self dictionaries] in TcSimplify.
That in turn means that EvDFunApp needs a dependency-list, used
when chasing dependencies in isGoodRecEv.
|
| |
|
|
|
|
|
|
|
|
|
| |
I ran across this bug and took the time to fix it, closing
a long time due TODO in InteractiveEval.hs
Instead of looking around to find the enclosing declaration
of a tick, this patch makes use of the information already collected during the
coverage desugaring phase
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See Trac #4488. The basic idea is to check for
fun :: ty -> ty
where fun is one of
toIntegerName toRationalName
fromIntegralName realToFracName
There's a (documented) flag to control it -fwarn-identities.
Currently -Wall switches it on.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
There are two main changes
* New LANGUAGE option RebindableSyntax, which implies NoImplicitPrelude
* if-the-else becomes rebindable, with function name "ifThenElse"
(but case expressions are unaffected)
Thanks to Sam Anklesaria for doing most of the work here
|
|
|
|
| |
See Note [Localise pattern binders]
|
| |
|
|
|
|
| |
Lots of comments with decomposeRuleLhs
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is patch that adds support for interruptible FFI calls in the form
of a new foreign import keyword 'interruptible', which can be used
instead of 'safe' or 'unsafe'. Interruptible FFI calls act like safe
FFI calls, except that the worker thread they run on may be interrupted.
Internally, it replaces BlockedOnCCall_NoUnblockEx with
BlockedOnCCall_Interruptible, and changes the behavior of the RTS
to not modify the TSO_ flags on the event of an FFI call from
a thread that was interruptible. It also modifies the bytecode
format for foreign call, adding an extra Word16 to indicate
interruptibility.
The semantics of interruption vary from platform to platform, but the
intent is that any blocking system calls are aborted with an error code.
This is most useful for making function calls to system library
functions that support interrupting. There is no support for pre-Vista
Windows.
There is a partner testsuite patch which adds several tests for this
functionality.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This big-ish patch arranges that if an Id 'f' is
* Type-class overloaded
f :: Ord a => [a] -> [a]
* Defined with an INLINABLE pragma
{-# INLINABLE f #-}
* Exported from its defining module 'D'
then in any module 'U' that imports D
1. Any call of 'f' at a fixed type will generate
(a) a specialised version of f in U
(b) a RULE that rewrites unspecialised calls to the
specialised on
e.g. if the call is (f Int dOrdInt xs) then the
specialiser will generate
$sfInt :: [Int] -> [Int]
$sfInt = <code for f, imported from D, specialised>
{-# RULE forall d. f Int d = $sfInt #-}
2. In addition, you can give an explicit {-# SPECIALISE -#}
pragma for the imported Id
{-# SPECIALISE f :: [Bool] -> [Bool] #-}
This too generates a local specialised definition,
and the corresponding RULE
The new RULES are exported from module 'U', so that any module
importing U will see the specialised versions of 'f', and will
not re-specialise them.
There's a flag -fwarn-auto-orphan that warns you if the auto-generated
RULES are orphan rules. It's not in -Wall, mainly to avoid lots of
error messages with existing packages.
Main implementation changes
- A new flag on a CoreRule to say if it was auto-generated.
This is persisted across interface files, so there's a small
change in interface file format.
- Quite a bit of fiddling with plumbing, to get the
{-# SPECIALISE #-} pragmas for imported Ids. In particular, a
new field tgc_imp_specs in TcGblEnv, to keep the specialise
pragmas for imported Ids between the typechecker and the desugarer.
- Some new code (although surprisingly little) in Specialise,
to deal with calls of imported Ids
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
I had do to some refactoring to make this work nicely
but now it does. I can't think how this escaped our
attention for so long!
|
|
|
|
|
|
|
|
| |
lambdas
This makes
\(x:xs) -> e
want when you have -fwarn-incomplete-patterns, which is consistent.
|
|
|
|
| |
and remove the temporary DOpt class workaround.
|
|
|
|
| |
Implements Trac #4299. Documentation to come.
|
|
|
|
|
|
|
|
| |
We still have
insertList, insertListWith, deleteList
which aren't in Data.Map, and
foldRightWithKey
which works around the fold(r)WithKey addition and deprecation.
|
|
|
|
| |
and adjust imports accordingly
|
|
|
|
|
|
|
|
|
| |
This major patch implements the new OutsideIn constraint solving
algorithm in the typecheker, following our JFP paper "Modular type
inference with local assumptions".
Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
|
| |
|
| |
|
|
|
|
|
|
| |
Get the set of free variables from the generated case expression:
includes variables in the guards and decls that were missed before,
and is also a bit simpler.
|
|
|
|
|
|
|
|
|
|
|
|
| |
See Note [DFun unfoldings] in CoreSyn. The issue here is that
you can't tell how many dictionary arguments a DFun needs just
from looking at the Arity of the DFun Id: if the dictionary is
represented by a newtype the arity might include the dictionary
and value arguments of the (single) method.
So we need to record the number of arguments need by the DFun
in the DFunUnfolding itself. Details in
Note [DFun unfoldings] in CoreSyn
|