diff options
| author | Max Bolingbroke <batterseapower@hotmail.com> | 2011-09-06 17:22:47 +0100 |
|---|---|---|
| committer | Max Bolingbroke <batterseapower@hotmail.com> | 2011-09-06 20:48:41 +0100 |
| commit | 9729fe7c3e54597ccf29c43c8c8ad0eaa2402ced (patch) | |
| tree | 1ad67ec5008c8f30a7a8a01fa44cb35b9ce619d4 /compiler/rename/RnSource.lhs | |
| parent | b98267adc04266e0001019fb17746be570cc79ae (diff) | |
| download | haskell-9729fe7c3e54597ccf29c43c8c8ad0eaa2402ced.tar.gz | |
Implement -XConstraintKind
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)
Diffstat (limited to 'compiler/rename/RnSource.lhs')
| -rw-r--r-- | compiler/rename/RnSource.lhs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rename/RnSource.lhs b/compiler/rename/RnSource.lhs index 2f01d7d418..76b81465f9 100644 --- a/compiler/rename/RnSource.lhs +++ b/compiler/rename/RnSource.lhs @@ -27,6 +27,7 @@ import RnNames ( getLocalNonValBinders, extendGlobalRdrEnvRn, lookupTcdNa import HscTypes ( AvailInfo(..) ) import RnHsDoc ( rnHsDoc, rnMbLHsDoc ) import TcRnMonad +import Kind ( liftedTypeKind ) import ForeignCall ( CCallTarget(..) ) import Module @@ -42,7 +43,6 @@ import Util ( filterOut ) import SrcLoc import DynFlags import HscTypes ( HscEnv, hsc_dflags ) -import BasicTypes ( Boxity(..) ) import ListSetOps ( findDupsEq ) import Digraph ( SCC, flattenSCC, stronglyConnCompFromEdgedVertices ) @@ -424,7 +424,7 @@ rnSrcInstDecl :: InstDecl RdrName -> RnM (InstDecl Name, FreeVars) rnSrcInstDecl (InstDecl inst_ty mbinds uprags ats) -- Used for both source and interface file decls = do { inst_ty' <- rnHsSigType (text "an instance decl") inst_ty - ; let (inst_tyvars, _, L _ cls, _) = splitHsInstDeclTy inst_ty' + ; let Just (inst_tyvars, _, L _ cls,_) = splitLHsInstDeclTy_maybe inst_ty' -- Rename the bindings -- The typechecker (not the renamer) checks that all @@ -991,7 +991,7 @@ rnConDecl decl@(ConDecl { con_name = name, con_qvars = tvs , con_details = new_details', con_res = new_res_ty, con_doc = mb_doc' }) }} where doc = text "In the definition of data constructor" <+> quotes (ppr name) - get_rdr_tvs tys = extractHsRhoRdrTyVars cxt (noLoc (HsTupleTy Boxed tys)) + get_rdr_tvs tys = extractHsRhoRdrTyVars cxt (noLoc (HsTupleTy (HsBoxyTuple liftedTypeKind) tys)) rnConResult :: SDoc -> HsConDetails (LHsType Name) [ConDeclField Name] |
