{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeInType #-}
module Optics.ReadOnly
( ToReadOnly(..)
) where
import Data.Profunctor.Indexed
import Optics.Internal.Bi
import Optics.Internal.Optic
class ToReadOnly k s t a b where
type ReadOnlyOptic k :: OpticKind
getting :: Optic k is s t a b -> Optic' (ReadOnlyOptic k) is s a
instance ToReadOnly An_Iso s t a b where
type ReadOnlyOptic An_Iso = A_Getter
getting :: forall (is :: IxList).
Optic An_Iso is s t a b -> Optic' (ReadOnlyOptic An_Iso) is s a
getting Optic An_Iso is s t a b
o = forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ Optic An_Iso is s t a b
o)
{-# INLINE getting #-}
instance ToReadOnly A_Lens s t a b where
type ReadOnlyOptic A_Lens = A_Getter
getting :: forall (is :: IxList).
Optic A_Lens is s t a b -> Optic' (ReadOnlyOptic A_Lens) is s a
getting Optic A_Lens is s t a b
o = forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ Optic A_Lens is s t a b
o)
{-# INLINE getting #-}
instance ToReadOnly A_Prism s t a b where
type ReadOnlyOptic A_Prism = An_AffineFold
getting :: forall (is :: IxList).
Optic A_Prism is s t a b -> Optic' (ReadOnlyOptic A_Prism) is s a
getting Optic A_Prism is s t a b
o = forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ Optic A_Prism is s t a b
o)
{-# INLINE getting #-}
instance ToReadOnly An_AffineTraversal s t a b where
type ReadOnlyOptic An_AffineTraversal = An_AffineFold
getting :: forall (is :: IxList).
Optic An_AffineTraversal is s t a b
-> Optic' (ReadOnlyOptic An_AffineTraversal) is s a
getting Optic An_AffineTraversal is s t a b
o = forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ Optic An_AffineTraversal is s t a b
o)
{-# INLINE getting #-}
instance ToReadOnly A_Traversal s t a b where
type ReadOnlyOptic A_Traversal = A_Fold
getting :: forall (is :: IxList).
Optic A_Traversal is s t a b
-> Optic' (ReadOnlyOptic A_Traversal) is s a
getting Optic A_Traversal is s t a b
o = forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ Optic A_Traversal is s t a b
o)
{-# INLINE getting #-}
instance ToReadOnly A_ReversedPrism s t a b where
type ReadOnlyOptic A_ReversedPrism = A_Getter
getting :: forall (is :: IxList).
Optic A_ReversedPrism is s t a b
-> Optic' (ReadOnlyOptic A_ReversedPrism) is s a
getting Optic A_ReversedPrism is s t a b
o = forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ Optic A_ReversedPrism is s t a b
o)
{-# INLINE getting #-}
instance (s ~ t, a ~ b) => ToReadOnly A_Getter s t a b where
type ReadOnlyOptic A_Getter = A_Getter
getting :: forall (is :: IxList).
Optic A_Getter is s t a b -> Optic' (ReadOnlyOptic A_Getter) is s a
getting = forall a. a -> a
id
{-# INLINE getting #-}
instance (s ~ t, a ~ b) => ToReadOnly An_AffineFold s t a b where
type ReadOnlyOptic An_AffineFold = An_AffineFold
getting :: forall (is :: IxList).
Optic An_AffineFold is s t a b
-> Optic' (ReadOnlyOptic An_AffineFold) is s a
getting = forall a. a -> a
id
{-# INLINE getting #-}
instance (s ~ t, a ~ b) => ToReadOnly A_Fold s t a b where
type ReadOnlyOptic A_Fold = A_Fold
getting :: forall (is :: IxList).
Optic A_Fold is s t a b -> Optic' (ReadOnlyOptic A_Fold) is s a
getting = forall a. a -> a
id
{-# INLINE getting #-}
getting__
:: (Profunctor p, Bicontravariant p, Constraints k p)
=> Optic k is s t a b
-> Optic__ p i (Curry is i) s s a a
getting__ :: forall (p :: * -> * -> * -> *) k (is :: IxList) s t a b i.
(Profunctor p, Bicontravariant p, Constraints k p) =>
Optic k is s t a b -> Optic__ p i (Curry is i) s s a a
getting__ (Optic forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b
o) = forall (p :: * -> * -> * -> *) i c a b.
(Profunctor p, Bicontravariant p) =>
p i c a -> p i c b
rphantom forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b
o forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> * -> *) i c a b.
(Profunctor p, Bicontravariant p) =>
p i c a -> p i c b
rphantom
{-# INLINE getting__ #-}