Open SquidDev opened 5 years ago
So one potentially neat thing that CamlP4 does is using and
instead of *
for constructors. So one might have declare lists like so instead:
type list 'a =
| Nil
| (::) of 'a and list 'a
Allows us to distinguish between tuples and curried constructors, while not breaking backwards compat (not that that is exactly a concern).
Instead of passing a tuple or record to constructors, you should be able to create them from multiple fields. This offers several advantages:
let x :: xs = Cons (x, xs)
wrappers), etc...