1{-# language DataKinds #-}
2{-# language TypeFamilies #-}
3{-# language StandaloneKindSignatures #-}
5module Rel8.Schema.Column
11import Data.Kind ( Type )
15import Rel8.Kind.Necessity ( Necessity( Required, Optional ) )
16import Rel8.Schema.Field ( Field )
17import qualified Rel8.Schema.Kind as K
20type Default :: Type -> Type
24type GetNecessity :: Type -> Necessity
25type family GetNecessity a where
26 GetNecessity (Default _) = 'Optional
27 GetNecessity _ = 'Required
30type UnwrapDefault :: Type -> Type
31type family UnwrapDefault a where
32 UnwrapDefault (Default a) = a
36-- | The @Column@ type family should be used to indicate which fields of your
37-- data types are single columns in queries. This type family has special
38-- support when a query is executed, allowing you to use a single data type for
39-- both query data and rows decoded to Haskell.
40type Column :: K.Context -> Type -> Type
41type Column context a =
42 Field context (GetNecessity a) (UnwrapDefault a)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list