1{-# language DataKinds #-}
2{-# language LambdaCase #-}
3{-# language FlexibleInstances #-}
4{-# language MultiParamTypeClasses #-}
5{-# language StandaloneKindSignatures #-}
6{-# language TypeFamilies #-}
7{-# language TypeOperators #-}
9module Rel8.Schema.Context.Label
10 ( Labelable( labeler, unlabeler )
11 , HLabelable( hlabeler, hunlabeler )
16import Data.Functor.Identity ( Identity )
17import Data.Kind ( Constraint )
18import Prelude hiding ( null )
21import Rel8.Aggregate ( Aggregate )
22import Rel8.Expr ( Expr )
23import Rel8.Schema.Context
24 ( Interpretation, Col, Col'(..), IsSpecialContext
27import qualified Rel8.Schema.Kind as K
28import Rel8.Schema.Spec ( Spec( Spec ) )
31type Labelable :: K.Context -> Constraint
32class Interpretation context => Labelable context where
34 => Col context ('Spec labels necessity db a)
35 -> Col context ('Spec (label ': labels) necessity db a)
38 => Col context ('Spec (label ': labels) necessity db a)
39 -> Col context ('Spec labels necessity db a)
42instance Labelable Aggregate where
43 labeler (Aggregation aggregate) = Aggregation aggregate
44 unlabeler (Aggregation aggregate) = Aggregation aggregate
47instance Labelable Expr where
49 unlabeler (DB a) = DB a
52instance Labelable Insertion where
54 RequiredInsert a -> RequiredInsert a
55 OptionalInsert ma -> OptionalInsert ma
58 RequiredInsert a -> RequiredInsert a
59 OptionalInsert ma -> OptionalInsert ma
62instance Labelable Identity where
63 labeler (Result a) = Result a
64 unlabeler (Result a) = Result a
67instance {-# OVERLAPPABLE #-} IsSpecialContext context ~ 'False =>
70 labeler (Col a) = Col a
71 unlabeler (Col a) = Col a
74type HLabelable :: K.HContext -> Constraint
75class HLabelable context where
77 => context ('Spec labels necessity db a)
78 -> context ('Spec (label ': labels) necessity db a)
81 => context ('Spec (label ': labels) necessity db a)
82 -> context ('Spec labels necessity db a)
85instance (Labelable context, x ~ IsSpecialContext context) =>
86 HLabelable (Col' x context)
89 hunlabeler = unlabeler
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