Closed CGenie closed 4 years ago
It looks like you're trying to put it into (or take it from) a record? There are some issues with that, which is why it worked fine in your test function but not in the real situation.
The usual way of handling it is to use the concrete versions of the optic instead, so ALens
instead of Lens
, APrism'
instead of Prism'
, etc.
You can put your normal non-concretely-defined optics into a record typed with these, but when you pull them out you'll need to use cloneLens
or clonePrism
etc. before you can work with it as normal again.
OK indeed this fixed the issue, thank you!
Hello, I'm using
profunctor-lenses
v 6.2.0 with purescript 0.13.6. I'm getting the following error:for the following code: https://gitlab.iscpif.fr/gargantext/purescript-gargantext/blob/dev-user-page-lens-test/src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs#L137-154 The lens are defined here: https://gitlab.iscpif.fr/gargantext/purescript-gargantext/blob/dev-user-page-lens-test/src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Types.purs#L210-228
What is funnier, when I don't specify the types:
the code compiles fine. However, it will fail at compiling when I use both the
view
andset
functions (set
is currently commented out here: https://gitlab.iscpif.fr/gargantext/purescript-gargantext/blob/dev-user-page-lens-test/src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs#L179-180) The error is then:I tried to debug this somehow and created simple code with
view
andset
and created a stubfunc
which is somewhat similar tocontactInfoItemCpt
from above: https://gitlab.iscpif.fr/gargantext/purescript-gargantext/blob/dev-user-page-lens-test/src/LensTest.purs The functionfunc
can be called like this:This works fine however and I'm really lost here.
Any help appreciated :)