I have a data object which I access as follows.
foo ^? lens1 . _Just . lens2 . _Just . lens3 . _Just
Is there some builtin lens operator that allows this to be shorthanded like bellow?
foo ^? lens1 © lens2 © lens3
I have a data object which I access as follows.
foo ^? lens1 . _Just . lens2 . _Just . lens3 . _Just
Is there some builtin lens operator that allows this to be shorthanded like bellow?
foo ^? lens1 © lens2 © lens3
Copyright © 2021 Jogjafile Inc.
It's probably not in lens but you can easily define your own operator to insert
_Justin between two optics:where
Traversal'is the smallest common supertype ofLens'andPrism'expressible in lens (there is a more precise variant with profunctor lenses). Or here is a more general signature:Note that
(.?.)only inserts_Justin the middle; you still have to append it at the end: