{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PolyKinds #-}
module GHC.Generics.Lens
(
generic
, generic1
, _V1
, _U1
, _Par1
, _Rec1
, _K1
, _M1
, _L1
, _R1
, _UAddr
, _UChar
, _UDouble
, _UFloat
, _UInt
, _UWord
) where
import Control.Lens
import GHC.Exts (Char(..), Double(..), Float(..),
Int(..), Ptr(..), Word(..))
import qualified GHC.Generics as Generic
import GHC.Generics hiding (from, to)
generic :: (Generic a, Generic b) => Iso a b (Rep a g) (Rep b h)
generic :: forall a b g h.
(Generic a, Generic b) =>
Iso a b (Rep a g) (Rep b h)
generic = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall a x. Generic a => a -> Rep a x
Generic.from forall a x. Generic a => Rep a x -> a
Generic.to
{-# INLINE generic #-}
generic1 :: (Generic1 f, Generic1 g) => Iso (f a) (g b) (Rep1 f a) (Rep1 g b)
generic1 :: forall {k} {k} (f :: k -> *) (g :: k -> *) (a :: k) (b :: k).
(Generic1 f, Generic1 g) =>
Iso (f a) (g b) (Rep1 f a) (Rep1 g b)
generic1 = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1
{-# INLINE generic1 #-}
_V1 :: Over p f (V1 s) (V1 t) a b
_V1 :: forall {k} {k} {k} (p :: k -> * -> *) (f :: * -> *) (s :: k)
(t :: k) (a :: k) b.
Over p f (V1 s) (V1 t) a b
_V1 p a (f b)
_ = V1 s -> f (V1 t)
\case
{-# INLINE _V1 #-}
_U1 :: Iso (U1 p) (U1 q) () ()
_U1 :: forall {k} {k} (p :: k) (q :: k). Iso (U1 p) (U1 q) () ()
_U1 = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (forall a b. a -> b -> a
const ()) (forall a b. a -> b -> a
const forall k (p :: k). U1 p
U1)
{-# INLINE _U1 #-}
_Par1 :: Iso (Par1 p) (Par1 q) p q
_Par1 :: forall p q. Iso (Par1 p) (Par1 q) p q
_Par1 = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
coerced
{-# INLINE _Par1 #-}
_Rec1 :: Iso (Rec1 f p) (Rec1 g q) (f p) (g q)
_Rec1 :: forall {k} {k} (f :: k -> *) (p :: k) (g :: k -> *) (q :: k).
Iso (Rec1 f p) (Rec1 g q) (f p) (g q)
_Rec1 = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
coerced
{-# INLINE _Rec1 #-}
_K1 :: Iso (K1 i c p) (K1 j d q) c d
_K1 :: forall {k} {k} i c (p :: k) j d (q :: k).
Iso (K1 i c p) (K1 j d q) c d
_K1 = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
coerced
{-# INLINE _K1 #-}
_M1 :: Iso (M1 i c f p) (M1 j d g q) (f p) (g q)
_M1 :: forall {k} {k} i (c :: Meta) (f :: k -> *) (p :: k) j (d :: Meta)
(g :: k -> *) (q :: k).
Iso (M1 i c f p) (M1 j d g q) (f p) (g q)
_M1 = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
coerced
{-# INLINE _M1 #-}
_L1 :: Prism' ((f :+: g) a) (f a)
_L1 :: forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
Prism' ((:+:) f g a) (f a)
_L1 = forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism forall {k} {f :: k -> *} {p :: k} {g :: k -> *}. f p -> (:+:) f g p
remitter forall {k} {f :: k -> *} {g :: k -> *} {p :: k}.
(:+:) f g p -> Either ((:+:) f g p) (f p)
reviewer
where
remitter :: f p -> (:+:) f g p
remitter = forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1
reviewer :: (:+:) f g p -> Either ((:+:) f g p) (f p)
reviewer (L1 f p
l) = forall a b. b -> Either a b
Right f p
l
reviewer (:+:) f g p
x = forall a b. a -> Either a b
Left (:+:) f g p
x
{-# INLINE _L1 #-}
_R1 :: Prism' ((f :+: g) a) (g a)
_R1 :: forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
Prism' ((:+:) f g a) (g a)
_R1 = forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism forall {k} {g :: k -> *} {p :: k} {f :: k -> *}. g p -> (:+:) f g p
remitter forall {k} {f :: k -> *} {g :: k -> *} {p :: k}.
(:+:) f g p -> Either ((:+:) f g p) (g p)
reviewer
where
remitter :: g p -> (:+:) f g p
remitter = forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1
reviewer :: (:+:) f g p -> Either ((:+:) f g p) (g p)
reviewer (R1 g p
l) = forall a b. b -> Either a b
Right g p
l
reviewer (:+:) f g p
x = forall a b. a -> Either a b
Left (:+:) f g p
x
{-# INLINE _R1 #-}
_UAddr :: Iso (UAddr p) (UAddr q) (Ptr c) (Ptr d)
_UAddr :: forall {k} {k} (p :: k) (q :: k) c d.
Iso (UAddr p) (UAddr q) (Ptr c) (Ptr d)
_UAddr = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall {k} {p :: k} {a}. URec (Ptr ()) p -> Ptr a
remitter forall {k} {a} {p :: k}. Ptr a -> URec (Ptr ()) p
reviewer
where
remitter :: URec (Ptr ()) p -> Ptr a
remitter (UAddr Addr#
a) = forall a. Addr# -> Ptr a
Ptr Addr#
a
reviewer :: Ptr a -> URec (Ptr ()) p
reviewer (Ptr Addr#
a) = forall k (p :: k). Addr# -> URec (Ptr ()) p
UAddr Addr#
a
{-# INLINE _UAddr #-}
_UChar :: Iso (UChar p) (UChar q) Char Char
_UChar :: forall {k} {k} (p :: k) (q :: k). Iso (UChar p) (UChar q) Char Char
_UChar = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall {k} {p :: k}. URec Char p -> Char
remitter forall {k} {p :: k}. Char -> URec Char p
reviewer
where
remitter :: URec Char p -> Char
remitter (UChar Char#
c) = Char# -> Char
C# Char#
c
reviewer :: Char -> URec Char p
reviewer (C# Char#
c) = forall k (p :: k). Char# -> URec Char p
UChar Char#
c
{-# INLINE _UChar #-}
_UDouble :: Iso (UDouble p) (UDouble q) Double Double
_UDouble :: forall {k} {k} (p :: k) (q :: k).
Iso (UDouble p) (UDouble q) Double Double
_UDouble = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall {k} {p :: k}. URec Double p -> Double
remitter forall {k} {p :: k}. Double -> URec Double p
reviewer
where
remitter :: URec Double p -> Double
remitter (UDouble Double#
d) = Double# -> Double
D# Double#
d
reviewer :: Double -> URec Double p
reviewer (D# Double#
d) = forall k (p :: k). Double# -> URec Double p
UDouble Double#
d
{-# INLINE _UDouble #-}
_UFloat :: Iso (UFloat p) (UFloat q) Float Float
_UFloat :: forall {k} {k} (p :: k) (q :: k).
Iso (UFloat p) (UFloat q) Float Float
_UFloat = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall {k} {p :: k}. URec Float p -> Float
remitter forall {k} {p :: k}. Float -> URec Float p
reviewer
where
remitter :: URec Float p -> Float
remitter (UFloat Float#
f) = Float# -> Float
F# Float#
f
reviewer :: Float -> URec Float p
reviewer (F# Float#
f) = forall k (p :: k). Float# -> URec Float p
UFloat Float#
f
{-# INLINE _UFloat #-}
_UInt :: Iso (UInt p) (UInt q) Int Int
_UInt :: forall {k} {k} (p :: k) (q :: k). Iso (UInt p) (UInt q) Int Int
_UInt = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall {k} {p :: k}. URec Int p -> Int
remitter forall {k} {p :: k}. Int -> URec Int p
reviewer
where
remitter :: URec Int p -> Int
remitter (UInt Int#
i) = Int# -> Int
I# Int#
i
reviewer :: Int -> URec Int p
reviewer (I# Int#
i) = forall k (p :: k). Int# -> URec Int p
UInt Int#
i
{-# INLINE _UInt #-}
_UWord :: Iso (UWord p) (UWord q) Word Word
_UWord :: forall {k} {k} (p :: k) (q :: k). Iso (UWord p) (UWord q) Word Word
_UWord = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso forall {k} {p :: k}. URec Word p -> Word
remitter forall {k} {p :: k}. Word -> URec Word p
reviewer
where
remitter :: URec Word p -> Word
remitter (UWord Word#
w) = Word# -> Word
W# Word#
w
reviewer :: Word -> URec Word p
reviewer (W# Word#
w) = forall k (p :: k). Word# -> URec Word p
UWord Word#
w
{-# INLINE _UWord #-}