haskell-classes and instances
topdecl → . . .
| class tyconstr var [where {cdecl1; . . . ; cdecln}], n ≥ 1
| instance tyconstr instype [where {idecl1; . . . ; idecln}]
cdecl → typedecl | fundecl | infixdecl | var rhs instype → (tyconstr var1 . . . varn), n ≥ 0
| [var]
| (var1 → var2)
| (var1, . . . , varn), n ≥ 2 idecl → fundecl | var rhs
19
haskell-contexts
context → (tyconstr
1var1, . . . , tyconstr
nvarn), n ≥ 1 typedecl → var1, . . . , varn :: [context ⇒] type, n ≥ 1 topdecl → decl
| type . . .
| data . . .
| class [context ⇒] tyconstr var [where . . .]
| instance [context ⇒] tyconstr instype [where . . .]
20