amuletml / amulet

An ML-like functional programming language
https://amulet.works/
BSD 3-Clause "New" or "Revised" License
325 stars 15 forks source link

Curried constructors #127

Open SquidDev opened 5 years ago

SquidDev commented 5 years ago

Instead of passing a tuple or record to constructors, you should be able to create them from multiple fields. This offers several advantages:

SquidDev commented 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).