In SML (and similarly Haskell), if I write
datatype foo = Foo of int
I can use Foo
as a 1st class functional value with type int -> foo
. In Ocaml this is not so, I have to write something like (function x -> Foo x)
or give this snippet a name and use that. So my question is, is there a ppx which would generate these trivial functions for me automatically?