on f47423e help sign in
rel8/src/Rel8/Column/Maybe.hs
31 lines 822 B history raw
1{-# language DataKinds #-}
2{-# language StandaloneKindSignatures #-}
3{-# language TypeFamilyDependencies #-}
5module Rel8.Column.Maybe
6 ( HMaybe
7 )
8where
10-- base
11import Data.Kind ( Type )
12import Prelude
14-- rel8
15import Rel8.Aggregate ( Aggregate )
16import Rel8.Expr ( Expr )
17import qualified Rel8.Schema.Kind as K
18import Rel8.Schema.Name ( Name )
19import Rel8.Schema.Result ( Result )
20import Rel8.Table.Maybe ( MaybeTable )
23-- | Nest a 'Maybe' value within a 'Rel8able'. @HMaybe f a@ will produce a
24-- 'MaybeTable' @a@ in the 'Expr' context, and a 'Maybe' @a@ in the 'Result'
25-- context.
26type HMaybe :: K.Context -> Type -> Type
27type family HMaybe context = maybe | maybe -> context where
28 HMaybe Aggregate = MaybeTable Aggregate
29 HMaybe Expr = MaybeTable Expr
30 HMaybe Name = MaybeTable Name
31 HMaybe Result = Maybe