Suppose you have
type t =
| Foo
| Bar of int
| Baz of string
I understand in some of OCaml’s cousins you can do this, but in OCaml you specifically cannot say Bar
and receive a curried function that takes int
and will yield your value Bar int
.
So, to get the behavior I want, I’d have to write:
let foo = Foo
let bar n = Bar n
let baz s = Baz s
and say bar
instead of Bar
.
Fine. That’s easy enough, though I was wondering if there was a ppx rewriter that will generate these?