-ntyconapp :: { (RdrNameMonoType, [RdrNameMonoType]) }
-ntyconapp : ntycon { ($1, []) }
- | ntyconapp atype { case $1 of (t1,tys) -> (t1, tys ++ [$2]) }
-
-gtyconapp :: { (RdrName, [RdrNameMonoType]) }
-gtyconapp : gtycon { ($1, []) }
- | gtyconapp atype { case $1 of (tc,tys) -> (tc, tys ++ [$2]) }
-
-atype :: { RdrNameMonoType }
-atype : gtycon { MonoTyApp $1 [] }
- | ntycon { $1 }
-
-atypes :: { [RdrNameMonoType] }
-atypes : atype { [$1] }
- | atypes atype { $1 ++ [$2] }
-
-ntycon :: { RdrNameMonoType }
-ntycon : VARID { MonoTyVar (Unqual $1) }
- | OPAREN type COMMA types CPAREN { MonoTupleTy ($2 : $4) }
- | OBRACK type CBRACK { MonoListTy $2 }
- | OPAREN type CPAREN { $2 }
-
-gtycon :: { RdrName }
-gtycon : QCONID { $1 }
- | CONID { Unqual $1 }
- | OPAREN RARROW CPAREN { Unqual SLIT("->") }
- | OBRACK CBRACK { Unqual SLIT("[]") }
- | OPAREN CPAREN { Unqual SLIT("()") }
- | OPAREN commas CPAREN { Unqual (mkTupNameStr $2) }
-
-commas :: { Int }
-commas : COMMA { 2{-1 comma => arity 2-} }
- | commas COMMA { $1 + 1 }
-
-simple :: { (RdrName, [FAST_STRING]) }
-simple : gtycon { ($1, []) }
- | gtyconvars { case $1 of (tc,tvs) -> (tc, reverse tvs) }
-
-gtyconvars :: { (RdrName, [FAST_STRING] {-reversed-}) }
-gtyconvars : gtycon VARID { ($1, [$2]) }
- | gtyconvars VARID { case $1 of (tc,tvs) -> (tc, $2 : tvs) }
-
-constrs :: { [(RdrName, RdrNameConDecl)] }
-constrs : constr { [$1] }
- | constrs VBAR constr { $1 ++ [$3] }
-
-constr :: { (RdrName, RdrNameConDecl) }
-constr : btyconapp
- { case $1 of (con, tys) -> (con, ConDecl con tys mkIfaceSrcLoc) }
- | OPAREN QCONSYM CPAREN { ($2, ConDecl $2 [] mkIfaceSrcLoc) }
- | OPAREN QCONSYM CPAREN batypes { ($2, ConDecl $2 $4 mkIfaceSrcLoc) }
- | OPAREN CONSYM CPAREN { (Unqual $2, ConDecl (Unqual $2) [] mkIfaceSrcLoc) }
- | OPAREN CONSYM CPAREN batypes { (Unqual $2, ConDecl (Unqual $2) $4 mkIfaceSrcLoc) }
- | gtycon OCURLY fields CCURLY
- { ($1, RecConDecl $1 $3 mkIfaceSrcLoc) }
-
-btyconapp :: { (RdrName, [RdrNameBangType]) }
-btyconapp : gtycon { ($1, []) }
- | btyconapp batype { case $1 of (tc,tys) -> (tc, tys ++ [$2]) }
-
-bbtype :: { RdrNameBangType }
-bbtype : btype { Unbanged $1 }
- | BANG atype { Banged $2 }