Closed yairchu closed 3 years ago
Why was review made specific? Is that to assist type inference?
Yes.
We have getting
for getters, but no reviewing
to make Review
type "more polymorphic". The only problem with adding that is the name, but I guess reviewing
will be fine.
I attempted created a reviewing
and wound up with this:
reviewing ::
(Choice p, Bifunctor p, Functor f, Settable f) =>
APrism s t a b -> Optic' p f t b
reviewing p =
bimap f (fmap f)
where
f = runIdentity . unTagged . clonePrism p . Tagged . Identity
Will it suffice?
(I'm aware that the type is not as general as getting
's, but I haven't succeeded in making an equivalent one nor am I knowledgeable enough to tell if it can be done)
https://github.com/ekmett/lens/commit/e51df36d2f40513b7cc015d74b1477b46a24bf4c made
review
's type more specific.It was a problem for me when trying to do:
I ran into this when experimenting with this:
Simply re-implementing the old
review
made the above work:Why was
review
made specific? Is that to assist type inference?Note: I have a vague memory of having asked this before but I couldn't find such an issue. I apologise if that's indeed the case and I'm being redundant.