{-# OPTIONS_HADDOCK hide #-}
module Data.Generics.Internal.Optics
  ( module Optics.Core
  , module Optics.Internal.Optic
  , normaliseLens
  , normalisePrism
  , normaliseIso
  ) where

import Optics.Core
import Optics.Internal.Optic

normaliseLens :: Lens s t a b -> Lens s t a b
normaliseLens :: forall s t a b. Lens s t a b -> Lens s t a b
normaliseLens Lens s t a b
l = Lens s t a b
-> ((s -> a) -> (s -> b -> t) -> Lens s t a b) -> Lens s t a b
forall k (is :: IxList) s t a b r.
Is k A_Lens =>
Optic k is s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r
withLens Lens s t a b
l (\s -> a
_get s -> b -> t
_set -> (s -> a) -> (s -> b -> t) -> Lens s t a b
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens s -> a
_get s -> b -> t
_set)
{-# INLINE normaliseLens #-}

normalisePrism :: Prism s t a b -> Prism s t a b
normalisePrism :: forall s t a b. Prism s t a b -> Prism s t a b
normalisePrism Prism s t a b
l = Prism s t a b
-> ((b -> t) -> (s -> Either t a) -> Prism s t a b)
-> Prism s t a b
forall k (is :: IxList) s t a b r.
Is k A_Prism =>
Optic k is s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r
withPrism Prism s t a b
l (\b -> t
_get s -> Either t a
_set -> (b -> t) -> (s -> Either t a) -> Prism s t a b
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism b -> t
_get s -> Either t a
_set)
{-# INLINE normalisePrism #-}

normaliseIso :: Iso s t a b -> Iso s t a b
normaliseIso :: forall s t a b. Iso s t a b -> Iso s t a b
normaliseIso Iso s t a b
l = Iso s t a b -> ((s -> a) -> (b -> t) -> Iso s t a b) -> Iso s t a b
forall s t a b r. Iso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
withIso Iso s t a b
l (\s -> a
_get b -> t
_set -> (s -> a) -> (b -> t) -> Iso s t a b
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso s -> a
_get b -> t
_set)
{-# INLINE normaliseIso #-}