- -- 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 ->
+ do { (tc, tvs, typats) <- checkSynHdr $3 True
+ ; return (L (comb2 $1 ty)
+ (TySynonym tc tvs typats ty)) }
+ }
+
+ -- data type or newtype declaration