{-# 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 :: 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 :: OpticKind) (is :: IxList) (s :: OpticKind)
       (t :: OpticKind) (a :: OpticKind) (b :: OpticKind)
       (r :: OpticKind).
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 :: OpticKind) (a :: OpticKind) (b :: OpticKind)
       (t :: OpticKind).
(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 :: 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 :: OpticKind) (is :: IxList) (s :: OpticKind)
       (t :: OpticKind) (a :: OpticKind) (b :: OpticKind)
       (r :: OpticKind).
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 :: OpticKind) (t :: OpticKind) (s :: OpticKind)
       (a :: OpticKind).
(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 :: 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 :: OpticKind) (t :: OpticKind) (a :: OpticKind)
       (b :: OpticKind) (r :: OpticKind).
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 :: OpticKind) (a :: OpticKind) (b :: OpticKind)
       (t :: OpticKind).
(s -> a) -> (b -> t) -> Iso s t a b
iso s -> a
_get b -> t
_set)
{-# INLINE normaliseIso #-}