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 