Open amesgen opened 3 years ago
Have you seen https://github.com/LiamGoodacre/purescript-generics-rep-optics? It also provides optics based on generics-rep.
Ah cool, I was not aware of that library. It seems to need a few slight changes to compile again, and has some differences (like not supporting constructors with zero or more than one argument). While I thought it would be nice to have something dual to field
in profunctor-lenses, one other route would be to create a PR to https://github.com/LiamGoodacre/purescript-generics-rep-optics.
Description of the change
Generic prisms, inspired by Haskell's generic-lens, see
_Ctor
._CC
in the first example in the test suite can not be inlined (without a type annotation), but_BB
can be inlined without a type signature in the second one. Maybe there are some PureScript-specific tricks (maybe some fundep stuff) to get around this, but I think this PR would be useful even with this slightly suboptimal inferability.Checklist: