{-# language DataKinds #-}
{-# language DeriveAnyClass #-}
{-# language DeriveGeneric #-}
{-# language DerivingStrategies #-}
{-# language StandaloneKindSignatures #-}

module Rel8.Schema.HTable.Either
  ( HEitherTable(..)
  )
where

-- base
import GHC.Generics ( Generic )
import Prelude ()

-- rel8
import Rel8.Schema.HTable ( HTable )
import Rel8.Schema.HTable.Identity ( HIdentity(..) )
import Rel8.Schema.HTable.Label ( HLabel )
import Rel8.Schema.HTable.Nullify ( HNullify )
import qualified Rel8.Schema.Kind as K
import Rel8.Schema.Spec ( Spec( Spec ) )
import Rel8.Type.Tag ( EitherTag )


type HEitherTable :: K.HTable -> K.HTable -> K.HTable
data HEitherTable left right context = HEitherTable
  { HEitherTable left right context
-> HIdentity ('Spec '["isRight"] EitherTag) context
htag :: HIdentity ('Spec '["isRight"] EitherTag) context
  , HEitherTable left right context
-> HLabel "Left" (HNullify left) context
hleft :: HLabel "Left" (HNullify left) context
  , HEitherTable left right context
-> HLabel "Right" (HNullify right) context
hright :: HLabel "Right" (HNullify right) context
  }
  deriving stock (forall x.
 HEitherTable left right context
 -> Rep (HEitherTable left right context) x)
-> (forall x.
    Rep (HEitherTable left right context) x
    -> HEitherTable left right context)
-> Generic (HEitherTable left right context)
forall x.
Rep (HEitherTable left right context) x
-> HEitherTable left right context
forall x.
HEitherTable left right context
-> Rep (HEitherTable left right context) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (left :: HTable) (right :: HTable) (context :: HContext) x.
Rep (HEitherTable left right context) x
-> HEitherTable left right context
forall (left :: HTable) (right :: HTable) (context :: HContext) x.
HEitherTable left right context
-> Rep (HEitherTable left right context) x
$cto :: forall (left :: HTable) (right :: HTable) (context :: HContext) x.
Rep (HEitherTable left right context) x
-> HEitherTable left right context
$cfrom :: forall (left :: HTable) (right :: HTable) (context :: HContext) x.
HEitherTable left right context
-> Rep (HEitherTable left right context) x
Generic
  deriving anyclass HEitherTable left right SSpec
(forall (context :: HContext) (spec :: Spec).
 HEitherTable left right context
 -> HField (HEitherTable left right) spec -> context spec)
-> (forall (context :: HContext).
    (forall (spec :: Spec).
     HField (HEitherTable left right) spec -> context spec)
    -> HEitherTable left right context)
-> (forall (m :: * -> *) (f :: HContext) (g :: HContext).
    Apply m =>
    (forall (spec :: Spec). f spec -> m (g spec))
    -> HEitherTable left right f -> m (HEitherTable left right g))
-> (forall (c :: Spec -> Constraint).
    HConstrainTable (HEitherTable left right) c =>
    HEitherTable left right (Dict c))
-> HEitherTable left right SSpec
-> HTable (HEitherTable left right)
forall (m :: * -> *) (f :: HContext) (g :: HContext).
Apply m =>
(forall (spec :: Spec). f spec -> m (g spec))
-> HEitherTable left right f -> m (HEitherTable left right g)
forall (c :: Spec -> Constraint).
HConstrainTable (HEitherTable left right) c =>
HEitherTable left right (Dict c)
forall (context :: HContext).
(forall (spec :: Spec).
 HField (HEitherTable left right) spec -> context spec)
-> HEitherTable left right context
forall (context :: HContext) (spec :: Spec).
HEitherTable left right context
-> HField (HEitherTable left right) spec -> context spec
forall (t :: HTable).
(forall (context :: HContext) (spec :: Spec).
 t context -> HField t spec -> context spec)
-> (forall (context :: HContext).
    (forall (spec :: Spec). HField t spec -> context spec)
    -> t context)
-> (forall (m :: * -> *) (f :: HContext) (g :: HContext).
    Apply m =>
    (forall (spec :: Spec). f spec -> m (g spec)) -> t f -> m (t g))
-> (forall (c :: Spec -> Constraint).
    HConstrainTable t c =>
    t (Dict c))
-> t SSpec
-> HTable t
forall (left :: HTable) (right :: HTable).
(HTable left, HTable right) =>
HEitherTable left right SSpec
forall (left :: HTable) (right :: HTable) (m :: * -> *)
       (f :: HContext) (g :: HContext).
(HTable left, HTable right, Apply m) =>
(forall (spec :: Spec). f spec -> m (g spec))
-> HEitherTable left right f -> m (HEitherTable left right g)
forall (left :: HTable) (right :: HTable)
       (c :: Spec -> Constraint).
(HTable left, HTable right,
 HConstrainTable (HEitherTable left right) c) =>
HEitherTable left right (Dict c)
forall (left :: HTable) (right :: HTable) (context :: HContext).
(HTable left, HTable right) =>
(forall (spec :: Spec).
 HField (HEitherTable left right) spec -> context spec)
-> HEitherTable left right context
forall (left :: HTable) (right :: HTable) (context :: HContext)
       (spec :: Spec).
(HTable left, HTable right) =>
HEitherTable left right context
-> HField (HEitherTable left right) spec -> context spec
hspecs :: HEitherTable left right SSpec
$chspecs :: forall (left :: HTable) (right :: HTable).
(HTable left, HTable right) =>
HEitherTable left right SSpec
hdicts :: HEitherTable left right (Dict c)
$chdicts :: forall (left :: HTable) (right :: HTable)
       (c :: Spec -> Constraint).
(HTable left, HTable right,
 HConstrainTable (HEitherTable left right) c) =>
HEitherTable left right (Dict c)
htraverse :: (forall (spec :: Spec). f spec -> m (g spec))
-> HEitherTable left right f -> m (HEitherTable left right g)
$chtraverse :: forall (left :: HTable) (right :: HTable) (m :: * -> *)
       (f :: HContext) (g :: HContext).
(HTable left, HTable right, Apply m) =>
(forall (spec :: Spec). f spec -> m (g spec))
-> HEitherTable left right f -> m (HEitherTable left right g)
htabulate :: (forall (spec :: Spec).
 HField (HEitherTable left right) spec -> context spec)
-> HEitherTable left right context
$chtabulate :: forall (left :: HTable) (right :: HTable) (context :: HContext).
(HTable left, HTable right) =>
(forall (spec :: Spec).
 HField (HEitherTable left right) spec -> context spec)
-> HEitherTable left right context
hfield :: HEitherTable left right context
-> HField (HEitherTable left right) spec -> context spec
$chfield :: forall (left :: HTable) (right :: HTable) (context :: HContext)
       (spec :: Spec).
(HTable left, HTable right) =>
HEitherTable left right context
-> HField (HEitherTable left right) spec -> context spec
HTable