Class for read-write optics that have their read-only counterparts.
Associated types
type family ReadOnlyOptic (k :: OpticKind) :: OpticKind
Methods
getting :: Optic k is s t a b -> Optic' (ReadOnlyOptic k) is s aTurn read-write optic into its read-only counterpart (or leave read-only optics as-is).
This is useful when you have an
optic :: Optic k is s t a bof read-write kindksuch thats,t,a,bare rigid, there is no evidence thats ~ tanda ~ band you want to passopticto one of the functions that accept read-only optic kinds.Example:
Example1 expression let fstIntToChar = _1 :: Lens (Int, r) (Char, r) Int CharExample1 expression :t view fstIntToChar......Couldn't match type ‘Char’ with ‘Int’...
Example1 expression :t view (getting fstIntToChar)view (getting fstIntToChar) :: (Int, r) -> Int
Instances9ToReadOnly, …
ToReadOnly A_Lens s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnlyToReadOnly A_Prism s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnlyToReadOnly A_ReversedPrism s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnlyToReadOnly A_Traversal s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnlyToReadOnly An_AffineTraversal s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnlyToReadOnly An_Iso s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnly(s ~ t, a ~ b) => ToReadOnly A_Fold s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnly(s ~ t, a ~ b) => ToReadOnly A_Getter s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnly(s ~ t, a ~ b) => ToReadOnly An_AffineFold s t a bDefined in optics-core-0.4.1.1 · Optics.ReadOnly