Just for the record: If you want to place a constraint upon your parameterized FAE
, the syntax is wrong; it should be data [context =>] simpletype = constrs [deriving]
as per the Haskell Report http://www.haskell.org/onlinereport/decls.html
If I am not mistaken (cannot try it out at the moment), however, you can also place additional constraints upon the indivual constructor functions
by providing an explicit function declaration for NumE
, etc. (no definition; that is already handled by the algebraic type declaration) which is more restrictive than what Haskell would infer from the data
declaration alone. Not that you need to for this task...