Make lenses-ppx supporting uncurried mode

Hi !

I’m preparing our codebase to support the next ReScript version and noticed an issue with lenses-ppx (we use it a lot with our form system) producing curried code.
I tried (naively) to just force the arity with the dot “.” (using AI to help me setup everything) but I don’t understand what’s missing :thinking:

I created a repo with my attempt.

Thanks for your help again :smiley:

We found a “workaround” to this by using the value of the variant as the key and write by ourself the get and set value.

  let get:
    type value. @u (Lenses.state, Lenses.field<value>) => value =
    @u
    (values, field) =>
      Obj.magic(values)->Js.Dict.get(field->Obj.magic->Lodash.lowerFirst)->Obj.magic

  let set:
    type value. @u (Lenses.state, Lenses.field<value>, value) => Lenses.state =
    @u
    (values, field, value) => {
      Obj.magic(values)->Js.Dict.set(field->Obj.magic->Lodash.lowerFirst->Obj.magic, value)

      values
    }

So we kept the ppx to just generate the GADT variant.
This is really dangerous as we rely of the compiler behavior so be careful :smiley: