Open
Description
Hi, apologies, this is neither a feature request nor a bug report. But a question that I did not know where else to ask.
Is there a way to derive a capability using a lens into a state? I understand that the Field
/HasField
and Pos
/HasPos
capabilities relate to their lens counterpats. But in my case I have a lens
view :: a -> b
view = ...
update :: a -> b -> a
update = ...
and a capability HasState "stateName" b
and I would like to turn it into a HasState "stateName" a
using the lens described above. The ideal type signature would be something like
focus :: HasState t b m => Lens a b -> (forall m' . HasState t a m' => m' r) -> m r
Is there a way to achieve this?
Intuitively, I would assume zoom
achieves that but I do not see what transformer to use or how to even define one.
Metadata
Metadata
Assignees
Labels
No labels