| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
- Make sure that we have no implicit names in ifaces
- Any vectorisation info makes a module an orphan module
- Allow 'Show' in vectorised code without vectorising it for the moment
|
|
|
|
|
| |
This is a tiny feature improvement; see the ticket.
I have updated the user manual too.
|
|
|
|
|
|
|
|
|
|
|
| |
This new feature-ette, enable with -XInstanceSigs, lets
you give a type signature in an instance declaration:
instance Eq Int where
(==) :: Int -> Int -> Bool
(==) = ...blah...
Scoped type variables work too.
|
|
|
|
|
|
|
|
| |
instance pragmas
* Correct usage of new type wrappers from MkId
* 'VECTORISE [SCALAR] type T = S' didn't work correctly across module boundaries
* Clean up 'VECTORISE SCALAR instance'
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now always check against an expected kind. When we really don't know what
kind to expect, we match against a new meta kind variable.
Also, we are more explicit about tuple sorts:
HsUnboxedTuple -> Produced by the parser
HsBoxedTuple -> Certainly a boxed tuple
HsConstraintTuple -> Certainly a constraint tuple
HsBoxedOrConstraintTuple -> Could be a boxed or a constraint
tuple. Produced by the parser only,
disappears after type checking
|
| |
|
|
|
|
|
|
|
|
|
| |
This big patch implements a kind-polymorphic core for GHC. The current
implementation focuses on making sure that all kind-monomorphic programs still
work in the new core; it is not yet guaranteed that kind-polymorphic programs
(using the new -XPolyKinds flag) will work.
For more information, see http://haskell.org/haskellwiki/GHC/Kinds
|
|
|
|
|
| |
We only use it for "compiler" sources, i.e. not for libraries.
Many modules have a -fno-warn-tabs kludge for now.
|
|
|
|
| |
* Frontend support (not yet used in the vectoriser)
|
|
|
|
|
|
|
| |
This was a trickier change than I had anticipated, but I think
it's considerably tidier now.
Fixes Trac #5533.
|
| |
|
|
|
|
|
|
| |
You can now use type functions in FFI types.
Newtypes are now only looked through if the constructor is in scope.
|
|
|
|
|
|
| |
(in instance and standalone deriving decls)
Fixes Trac #5513.
|
|
|
|
|
|
|
|
|
|
|
| |
We should not allow things like
class C a b where
type F a :: *
instance C (p,q) r where
type F (p,q) = r -- No! fvs(rhs) should be a subset
-- of fvs(lhs)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is work mostly done by Daniel Winograd-Cort during his
internship at MSR Cambridge, with some further refactoring by me.
This commit adds support to GHCi for most top-level declarations that
can be used in Haskell source files. Class, data, newtype, type,
instance are all supported, as are Type Family-related declarations.
The current set of declarations are shown by :show bindings. As with
variable bindings, entities bound by newer declarations shadow earlier
ones.
Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054.
Documentation to follow.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
compiler/iface/BuildTyCl.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/types/Class.lhs
compiler/utils/Util.lhs
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Basically as documented in http://hackage.haskell.org/trac/ghc/wiki/KindFact,
this patch adds a new kind Constraint such that:
Show :: * -> Constraint
(?x::Int) :: Constraint
(Int ~ a) :: Constraint
And you can write *any* type with kind Constraint to the left of (=>):
even if that type is a type synonym, type variable, indexed type or so on.
The following (somewhat related) changes are also made:
1. We now box equality evidence. This is required because we want
to give (Int ~ a) the *lifted* kind Constraint
2. For similar reasons, implicit parameters can now only be of
a lifted kind. (?x::Int#) => ty is now ruled out
3. Implicit parameter constraints are now allowed in superclasses
and instance contexts (this just falls out as OK with the new
constraint solver)
Internally the following major changes were made:
1. There is now no PredTy in the Type data type. Instead
GHC checks the kind of a type to figure out if it is a predicate
2. There is now no AClass TyThing: we represent classes as TyThings
just as a ATyCon (classes had TyCons anyway)
3. What used to be (~) is now pretty-printed as (~#). The box
constructor EqBox :: (a ~# b) -> (a ~ b)
4. The type LCoercion is used internally in the constraint solver
and type checker to represent coercions with free variables
of type (a ~ b) rather than (a ~# b)
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basically, now you can write:
class Cls a where
type Typ a
type Typ a = Just a
And now if an instance does not specify an explicit associated type
instance, one will be generated afresh based on that default. So for
example this instance:
instance Cls Int where
Will be equivalent to this one:
instance Cls Int where
type Typ Int = Just Int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a) Allow multiple AT decls for in a single instance
b) Allow a free type parameter to be instantiated
Example class C a where
type T a x :: *
data A
data B
instance C Int where
type T Int A = Int
type T Int B = Bool
There is no reason to prohibit this, and as we move
towards a proper kind system it may even be useful.
I also updated the documentation to cover this change
and the previous one of allowing free type parameters
for associated families.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch allows
class C a where
type T a b :: *
instance C Int
type T Int b = b -> b
That is, T has a type index 'b' that is not one of the class
variables.
On the way I did a good deal of refactoring (as usual), especially in
TcInstDcls.tcLocalInstDecl1, which checks for consistent instantiation
of the class instance and the type instance. Less code, more
expressiveness. See Note [Checking consistent instantiation]
|
|
|
|
|
|
|
|
|
| |
they are not declared, but only imported
- Types already gained this functionality already in a previous commit
- This commit adds the capability for functions
This is a crucial step towards being able to use the standard Prelude, instead of a special vectorised one.
|
|\ |
|
| |
| |
| |
| |
| |
| | |
VECTORISE pragmas to be a single identifier only.
- This removes the need to be careful about the order of dictionaries during type inference. A property that is too fragile to try to maintain in the type checker.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue is that in
instnace C T where
data S = ...
f = ...
neither S nor f is really a binder; they are *occurrences*. Moreover
Haskell dictates that these particular occurrences are disambiguated
by looking at the class whose instance they occur in.
Some of this was not handled right for associated types. And
RnNames.getLocalNonValBinders was a bit messhy; this patch tidies it
up.
(And thenM is finally gone from RnSource.)
|
|
|
|
|
|
|
|
|
| |
- Pragma to determine how a given type is vectorised
- At this stage only the VECTORISE SCALAR variant is used by the vectoriser.
- '{-# VECTORISE SCALAR type t #-}' implies that 't' cannot contain parallel arrays and may be used in vectorised code. However, its constructors can only be used in scalar code. We use this, e.g., for 'Int'.
- May be used on imported types
See also http://hackage.haskell.org/trac/ghc/wiki/DataParallel/VectPragma
|
| |
|
|
|
|
|
|
|
|
|
| |
We were returning the tycon of a type family *instance*
as a binder, and it just isn't!
Consequential tidy-ups follow. I tripped over this on
the way to something else. I'm not sure it was causing
a problem, but it is Plainly Wrong.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently export list in .hi files are partitioned by module
export M T(C1,C2)
N f,g
In each list we only have OccNames, all assumed to come from
the parent module M or N resp.
This patch changes the representatation so that export lists
have full Names:
export M.T(M.C1,M.C2), N.f, N.g
Numerous advatages
* AvailInfo no longer needs to be parameterised; it always
contains Names
* Fixes Trac #5306. This was the main provocation
* Less to-and-fro conversion when reading interface files
It's all generally simpler. Interface files should not get bigger,
becuase they have a nice compact representation for Names.
|
|
|
|
|
|
|
| |
We were doing this already for explicit types like
f :: forall a. Int
but not for constructor declarations. This patch
makes it consistent.
|
| |
|
|\ |
|
| |
| |
| |
| | |
toplevel variable 'f'.
|
|/
|
|
|
| |
This is a merge of a patch contributed by Michal Terepeta and the
recent generics changes.
|
|
|
|
| |
They belonged to the old generic deriving mechanism, so they can go. Adapted a lot of code as a consequence.
|
|\ |
|
| | |
|
|/
|
|
|
| |
(See his Haskell Symposium 2010 paper
"A generic deriving mechaism for Haskell")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
and remove the temporary DOpt class workaround.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
This patch moves various functions that extract the binders
from a HsTyClDecl, HsForeignDecl etc into HsUtils, and gives
them consistent names.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The tcg_dus field used to contain *uses* of type and class decls,
but not *defs*. That was inconsistent, and it really went wrong
for Template Haskell bracket. What happened was that
foo = [d| data A = A
f :: A -> A
f x = x |]
would find a "use" of A when processing the top level of the module,
which in turn led to a mkUsageInfo panic in MkIface. The cause was
the fact that the tcg_dus for the nested quote didn't have defs for
A.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue here is that
g :: A -> A
f
data A = A
is treated as if you'd written $(f); that is the call of
f is a top-level Template Haskell splice. This patch
makes sure that we *first* check the -XTemplateHaskellFlag
and bleat about a parse error if it's off. Othewise we
get strange seeing "A is out of scope" errors.
|
|
|
|
|
|
|
|
| |
The renamer wasn't computing the free variables of a type declaration
properly. This patch refactors a bit, and makes it more robust,
fixing #3955 and several other closely-related bugs. (We were
omitting some free variables and that could just possibly lead to a
usage-version tracking error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This one was bigger than I anticipated! The problem was that were
were gathering the binders from a pattern before renaming -- but with
record wild-cards we don't know what variables are bound by C {..}
until after the renamer has filled in the "..".
So this patch does the following
* Change all the collect-X-Binders functions in HsUtils so that
they expect to only be called *after* renaming. That means they
don't need to return [Located id] but just [id]. Which turned out
to be a very worthwhile simplification all by itself.
* Refactor the renamer, and in ptic RnExpr.rnStmt, so that it
doesn't need to use collectLStmtsBinders on pre-renamed Stmts.
* This in turn required me to understand how GroupStmt and
TransformStmts were renamed. Quite fiddly. I rewrote most of it;
result is much shorter.
* In doing so I flattened HsExpr.GroupByClause into its parent
GroupStmt, with trivial knock-on effects in other files.
Blargh.
|