{-# LANGUAGE PackageImports #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts #-}
module Data.Generics.Sum.Constructors
(
AsConstructor (..)
, AsConstructor_ (..)
, AsConstructor' (..)
, AsConstructor0 (..)
) where
import "this" Data.Generics.Internal.Optics
import "generic-lens-core" Data.Generics.Internal.Void
import qualified "generic-lens-core" Data.Generics.Sum.Internal.Constructors as Core
import GHC.TypeLits (Symbol)
class AsConstructor (ctor :: Symbol) s t a b | ctor s -> a, ctor t -> b where
_Ctor :: Prism s t a b
class AsConstructor_ (ctor :: Symbol) s t a b where
_Ctor_ :: Prism s t a b
class AsConstructor' (ctor :: Symbol) s a | ctor s -> a where
_Ctor' :: Prism s s a a
class AsConstructor0 (ctor :: Symbol) s t a b where
_Ctor0 :: Prism s t a b
instance (Core.Context' ctor s a, AsConstructor0 ctor s s a a) => AsConstructor' ctor s a where
_Ctor' :: Prism s s a a
_Ctor' = forall s t a b. AsConstructor0 ctor s t a b => Prism s t a b
forall (ctor :: Symbol) s t a b.
AsConstructor0 ctor s t a b =>
Prism s t a b
_Ctor0 @ctor
{-# INLINE _Ctor' #-}
instance (Core.Context ctor s t a b, AsConstructor0 ctor s t a b) => AsConstructor ctor s t a b where
_Ctor :: Prism s t a b
_Ctor = forall s t a b. AsConstructor0 ctor s t a b => Prism s t a b
forall (ctor :: Symbol) s t a b.
AsConstructor0 ctor s t a b =>
Prism s t a b
_Ctor0 @ctor
{-# INLINE _Ctor #-}
instance {-# OVERLAPPING #-} AsConstructor ctor (Void1 a) (Void1 b) a b where
_Ctor :: Prism (Void1 a) (Void1 b) a b
_Ctor = Prism (Void1 a) (Void1 b) a b
forall a. HasCallStack => a
undefined
instance (Core.Context_ ctor s t a b, AsConstructor0 ctor s t a b) => AsConstructor_ ctor s t a b where
_Ctor_ :: Prism s t a b
_Ctor_ = forall s t a b. AsConstructor0 ctor s t a b => Prism s t a b
forall (ctor :: Symbol) s t a b.
AsConstructor0 ctor s t a b =>
Prism s t a b
_Ctor0 @ctor
{-# INLINE _Ctor_ #-}
instance {-# OVERLAPPING #-} AsConstructor_ ctor (Void1 a) (Void1 b) a b where
_Ctor_ :: Prism (Void1 a) (Void1 b) a b
_Ctor_ = Prism (Void1 a) (Void1 b) a b
forall a. HasCallStack => a
undefined
instance Core.Context0 ctor s t a b => AsConstructor0 ctor s t a b where
_Ctor0 :: Prism s t a b
_Ctor0 = Prism s t a b -> Prism s t a b
forall s t a b. Prism s t a b -> Prism s t a b
normalisePrism ((forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ A_Prism p i (Curry NoIx i) s t a b)
-> Prism s t a b
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 s t a b. Context0 ctor s t a b => Prism s t a b
forall (ctor :: Symbol) s t a b.
Context0 ctor s t a b =>
Prism s t a b
Core.derived0 @ctor))
{-# INLINE _Ctor0 #-}