diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-05-11 18:02:18 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-05-11 18:02:31 +0100 |
commit | fc8959acae02605c71b775c8d403e38b5cc6fecd (patch) | |
tree | ed1184e995c279510d1684b78effa83dfc101193 /compiler/parser/ParserCore.y | |
parent | c1e928e4d6278d574b4e171b2da335cec6711fb8 (diff) | |
download | haskell-fc8959acae02605c71b775c8d403e38b5cc6fecd.tar.gz |
Refactor LHsTyVarBndrs to fix Trac #6081
This is really a small change, but it touches a lot of files quite
significantly. The real goal is to put the implicitly-bound kind
variables of a data/class decl in the right place, namely on the
LHsTyVarBndrs type, which now looks like
data LHsTyVarBndrs name
= HsQTvs { hsq_kvs :: [Name]
, hsq_tvs :: [LHsTyVarBndr name]
}
This little change made the type checker neater in a number of
ways, but it was fiddly to push through the changes.
Diffstat (limited to 'compiler/parser/ParserCore.y')
-rw-r--r-- | compiler/parser/ParserCore.y | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/parser/ParserCore.y b/compiler/parser/ParserCore.y index eee8831065..0382fcae7d 100644 --- a/compiler/parser/ParserCore.y +++ b/compiler/parser/ParserCore.y @@ -128,14 +128,14 @@ tdefs :: { [TyClDecl RdrName] } tdef :: { TyClDecl RdrName } : '%data' q_tc_name tv_bndrs '=' '{' cons '}' ';' { TyDecl { tcdLName = noLoc (ifaceExtRdrName $2) - , tcdTyVars = map toHsTvBndr $3 + , tcdTyVars = mkHsQTvs (map toHsTvBndr $3) , tcdTyDefn = TyData { td_ND = DataType, td_ctxt = noLoc [] , td_kindSig = Nothing , td_cons = $6, td_derivs = Nothing } } } | '%newtype' q_tc_name tv_bndrs trep ';' { let tc_rdr = ifaceExtRdrName $2 in TyDecl { tcdLName = noLoc tc_rdr - , tcdTyVars = map toHsTvBndr $3 + , tcdTyVars = mkHsQTvs (map toHsTvBndr $3) , tcdTyDefn = TyData { td_ND = NewType, td_ctxt = noLoc [] , td_kindSig = Nothing , td_cons = $4 (rdrNameOcc tc_rdr), td_derivs = Nothing } } } @@ -377,16 +377,16 @@ ifaceArrow ifT1 ifT2 = IfaceFunTy ifT1 ifT2 toHsTvBndr :: IfaceTvBndr -> LHsTyVarBndr RdrName toHsTvBndr (tv,k) = noLoc $ KindedTyVar (mkRdrUnqual (mkTyVarOccFS tv)) bsig where - bsig = mkHsBSig (toHsKind k) + bsig = toHsKind k ifaceExtRdrName :: Name -> RdrName ifaceExtRdrName name = mkOrig (nameModule name) (nameOccName name) ifaceExtRdrName other = pprPanic "ParserCore.ifaceExtRdrName" (ppr other) add_forall tv (L _ (HsForAllTy exp tvs cxt t)) - = noLoc $ HsForAllTy exp (tv:tvs) cxt t + = noLoc $ HsForAllTy exp (mkHsQTvs (tv : hsQTvBndrs tvs)) cxt t add_forall tv t - = noLoc $ HsForAllTy Explicit [tv] (noLoc []) t + = noLoc $ HsForAllTy Explicit (mkHsQTvs [tv]) (noLoc []) t happyError :: P a happyError s l = failP (show l ++ ": Parse error\n") (take 100 s) l |