- -- Note ctype, not sigtype, on the right
- -- We allow an explicit for-all but we don't insert one
- -- in type Foo a = (b,b)
- -- Instead we just say b is out of scope
- {% do { (tc,tvs) <- checkSynHdr $2
- ; return (LL (TySynonym tc tvs $4)) } }
-
+ -- We have that `typats :: Maybe [LHsType name]' is `Nothing'
+ -- (in the second case alternative) when all arguments are
+ -- variables (and we thus have a vanilla type synonym
+ -- declaration); otherwise, it contains all arguments as type
+ -- patterns.
+ --
+ {% case $4 of
+ Left kind ->
+ do { (tc, tvs, _) <- checkSynHdr $3 False
+ ; return (L (comb3 $1 $3 kind)
+ (TyFunction tc tvs $2 (unLoc kind)))
+ }
+ Right ty | not $2 ->
+ do { (tc, tvs, typats) <- checkSynHdr $3 True
+ ; return (L (comb2 $1 ty)
+ (TySynonym tc tvs typats ty)) }
+ Right ty | otherwise ->
+ parseError (comb2 $1 ty)
+ "iso tag is only allowed in kind signatures"
+ }
+
+ -- kind signature of indexed type
+ | data_or_newtype tycl_hdr '::' kind
+ {% do { let {(ctxt, tc, tvs, tparms) = unLoc $2}
+ ; checkTyVars tparms False -- no type pattern
+ ; return $
+ L (comb3 $1 $2 $4)
+ (mkTyData (unLoc $1) (ctxt, tc, tvs, Nothing)
+ (Just (unLoc $4)) [] Nothing) } }
+
+ -- data type or newtype declaration