view package:optics-core

View the value pointed to by a getter. If you want to view a type-modifying optic that is insufficiently polymorphic to be type-preserving, use getting.
A Seq is isomorphic to a ViewL
viewl m ≡ m ^. viewL
>>> Seq.fromList [1,2,3] ^. viewL
1 :< fromList [2,3]
>>> Seq.empty ^. viewL
EmptyL
>>> EmptyL ^. re viewL
fromList []
>>> review viewL $ 1 Seq.:< Seq.fromList [2,3]
fromList [1,2,3]
A Seq is isomorphic to a ViewR
viewr m ≡ m ^. viewR
>>> Seq.fromList [1,2,3] ^. viewR
fromList [1,2] :> 3
>>> Seq.empty ^. viewR
EmptyR
>>> EmptyR ^. re viewR
fromList []
>>> review viewR $ Seq.fromList [1,2] Seq.:> 3
fromList [1,2,3]
View the function of the value pointed to by a getter.
Retrieve the value targeted by an AffineFold.
>>> let _Right = prism Right $ either (Left . Left) Right
>>> preview _Right (Right 'x')
Just 'x'
>>> preview _Right (Left 'y')
Nothing
Retrieve a function of the value targeted by an AffineFold.
Tag for a review.
Retrieve the value along with its index targeted by an IxAffineFold.
Retrieve a function of the value and its index targeted by an IxAffineFold.
View the value pointed to by an indexed getter.
View the function of the value pointed to by an indexed getter.
A Review is a backwards Getter, i.e. a Review T B is just a function B -> T.
Type synonym for a review.
Retrieve the value targeted by a Review.
>>> review _Left "hi"
Left "hi"