module Optics.Coerce
( coerceS
, coerceT
, coerceA
, coerceB
) where
import Data.Coerce
import Optics.Internal.Optic
import Optics.Internal.Profunctor
coerceS
:: Coercible s s'
=> Optic k is s t a b
-> Optic k is s' t a b
coerceS = \(Optic o) -> Optic (lcoerce . o)
{-# INLINE coerceS #-}
coerceT
:: Coercible t t'
=> Optic k is s t a b
-> Optic k is s t' a b
coerceT = \(Optic o) -> Optic (rcoerce . o)
{-# INLINE coerceT #-}
coerceA
:: Coercible a a'
=> Optic k is s t a b
-> Optic k is s t a' b
coerceA = \(Optic o) -> Optic (o . lcoerce)
{-# INLINE coerceA #-}
coerceB
:: Coercible b b'
=> Optic k is s t a b
-> Optic k is s t a b'
coerceB = \(Optic o) -> Optic (o . rcoerce)
{-# INLINE coerceB #-}