I have some datatypes along the line of
data Outer = Outer { _list :: [ Inner ] }
data Inner = Inner { _bool :: Bool }
using Control.Lens, I can access the _bool of the ith Inner (inside a 'State Outer' monad) like this
boolValue <- gets (^. list . to (!! i) . inner)
I would like to also be able to update this value with something like
list ^. (to (!! i)) ^. inner %= True
However (by my understanding), the 'to' function only creates a getter, not a true lens that can be used as either getter or setter.
So, how can I convert (!! i) into a lens that will allow me to update this field?