Open rupertlssmith opened 5 years ago
Another possibility might be to enumerate the operators:
Operator =
Times
| Plus
| Minus
| ...
so that it becomes impossible to create an operator that does not exist in Elm.
opApply : Operator -> Expression -> Expression -> Expression
The associativity of an operator must be given when using it:
But it would not be hard to have the operator table in the DSL so it doesn't need to be told this, since the operators are fixed in number since Elm 0.19.
This would make a less clunky API: