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

module Rel8.Schema.HTable.Maybe
  ( HMaybeTable(..)
  )
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.Type.Tag ( MaybeTag )


type HMaybeTable :: K.HTable -> K.HTable
data HMaybeTable table context = HMaybeTable
  { HMaybeTable table context
-> HLabel "isJust" (HIdentity (Maybe MaybeTag)) context
htag :: HLabel "isJust" (HIdentity (Maybe MaybeTag)) context
  , HMaybeTable table context -> HLabel "Just" (HNullify table) context
hjust :: HLabel "Just" (HNullify table) context
  }
  deriving stock (forall x.
 HMaybeTable table context -> Rep (HMaybeTable table context) x)
-> (forall x.
    Rep (HMaybeTable table context) x -> HMaybeTable table context)
-> Generic (HMaybeTable table context)
forall x.
Rep (HMaybeTable table context) x -> HMaybeTable table context
forall x.
HMaybeTable table context -> Rep (HMaybeTable table context) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (table :: HTable) (context :: Context) x.
Rep (HMaybeTable table context) x -> HMaybeTable table context
forall (table :: HTable) (context :: Context) x.
HMaybeTable table context -> Rep (HMaybeTable table context) x
$cto :: forall (table :: HTable) (context :: Context) x.
Rep (HMaybeTable table context) x -> HMaybeTable table context
$cfrom :: forall (table :: HTable) (context :: Context) x.
HMaybeTable table context -> Rep (HMaybeTable table context) x
Generic
  deriving anyclass HMaybeTable table Spec
(forall (context :: Context) a.
 HMaybeTable table context
 -> HField (HMaybeTable table) a -> context a)
-> (forall (context :: Context).
    (forall a. HField (HMaybeTable table) a -> context a)
    -> HMaybeTable table context)
-> (forall (m :: Context) (f :: Context) (g :: Context).
    Apply m =>
    (forall a. f a -> m (g a))
    -> HMaybeTable table f -> m (HMaybeTable table g))
-> (forall (c :: * -> Constraint).
    HConstrainTable (HMaybeTable table) c =>
    HMaybeTable table (Dict c))
-> HMaybeTable table Spec
-> HTable (HMaybeTable table)
forall (c :: * -> Constraint).
HConstrainTable (HMaybeTable table) c =>
HMaybeTable table (Dict c)
forall (context :: Context).
(forall a. HField (HMaybeTable table) a -> context a)
-> HMaybeTable table context
forall (context :: Context) a.
HMaybeTable table context
-> HField (HMaybeTable table) a -> context a
forall (m :: Context) (f :: Context) (g :: Context).
Apply m =>
(forall a. f a -> m (g a))
-> HMaybeTable table f -> m (HMaybeTable table g)
forall (table :: HTable). HTable table => HMaybeTable table Spec
forall (table :: HTable) (c :: * -> Constraint).
(HTable table, HConstrainTable (HMaybeTable table) c) =>
HMaybeTable table (Dict c)
forall (table :: HTable) (context :: Context).
HTable table =>
(forall a. HField (HMaybeTable table) a -> context a)
-> HMaybeTable table context
forall (table :: HTable) (context :: Context) a.
HTable table =>
HMaybeTable table context
-> HField (HMaybeTable table) a -> context a
forall (table :: HTable) (m :: Context) (f :: Context)
       (g :: Context).
(HTable table, Apply m) =>
(forall a. f a -> m (g a))
-> HMaybeTable table f -> m (HMaybeTable table g)
forall (t :: HTable).
(forall (context :: Context) a.
 t context -> HField t a -> context a)
-> (forall (context :: Context).
    (forall a. HField t a -> context a) -> t context)
-> (forall (m :: Context) (f :: Context) (g :: Context).
    Apply m =>
    (forall a. f a -> m (g a)) -> t f -> m (t g))
-> (forall (c :: * -> Constraint).
    HConstrainTable t c =>
    t (Dict c))
-> t Spec
-> HTable t
hspecs :: HMaybeTable table Spec
$chspecs :: forall (table :: HTable). HTable table => HMaybeTable table Spec
hdicts :: HMaybeTable table (Dict c)
$chdicts :: forall (table :: HTable) (c :: * -> Constraint).
(HTable table, HConstrainTable (HMaybeTable table) c) =>
HMaybeTable table (Dict c)
htraverse :: (forall a. f a -> m (g a))
-> HMaybeTable table f -> m (HMaybeTable table g)
$chtraverse :: forall (table :: HTable) (m :: Context) (f :: Context)
       (g :: Context).
(HTable table, Apply m) =>
(forall a. f a -> m (g a))
-> HMaybeTable table f -> m (HMaybeTable table g)
htabulate :: (forall a. HField (HMaybeTable table) a -> context a)
-> HMaybeTable table context
$chtabulate :: forall (table :: HTable) (context :: Context).
HTable table =>
(forall a. HField (HMaybeTable table) a -> context a)
-> HMaybeTable table context
hfield :: HMaybeTable table context
-> HField (HMaybeTable table) a -> context a
$chfield :: forall (table :: HTable) (context :: Context) a.
HTable table =>
HMaybeTable table context
-> HField (HMaybeTable table) a -> context a
HTable