pdonadeo / ocaml-lens

Private extraction of astrada's lens library
56 stars 9 forks source link

Strange deriving error in presence of `lens.ppx_deriving` #14

Open psteckler opened 4 years ago

psteckler commented 4 years ago

See: https://discuss.ocaml.org/t/odd-deriving-error/4606

pdonadeo commented 4 years ago

@didier-wenzek what do you think?

didier-wenzek commented 4 years ago

I will have a look. I don't remember having done something special, neither to prevent nor to support this actual use case, where the ppx are called in cascade.

pdonadeo commented 4 years ago

Thanks @didier-wenzek. The problem is that I never dug into the ppx world so I can't reply to @psteckler.

didier-wenzek commented 4 years ago

I failed to reproduce the issue. I tried different combinations of derivers and transformers, but noticed no specific issues. Except that [@@deriving show][@@deriving lens] is not equivalent to [@@deriving show,lens]. The latter is working as expected, but the former ignores the second deriver (and this is not specifically due to the lens.ppx_deriving).

@psteckler can you share the [%%tranform ...] which triggers the issue. Thanks.

psteckler commented 4 years ago

I manually inserted the code that would have been created by deriving lens here:

https://github.com/CodaProtocol/coda/blob/develop/src/lib/parallel_scan/parallel_scan.ml#L63

The transformer which contains the type is [%%versioned], a few lines above.

If you'd like to build the code, there are instructions here:

https://github.com/CodaProtocol/coda/blob/develop/README-dev.md