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