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.
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/HasFieldandPos/HasPoscapabilities relate to their lens counterpats. But in my case I have a lensand a capability
HasState "stateName" band I would like to turn it into aHasState "stateName" ausing the lens described above. The ideal type signature would be something likefocus :: HasState t b m => Lens a b -> (forall m' . HasState t a m' => m' r) -> m rIs there a way to achieve this?
Intuitively, I would assume
zoomachieves that but I do not see what transformer to use or how to even define one.