1{-# language AllowAmbiguousTypes #-}
2{-# language EmptyCase #-}
3{-# language DataKinds #-}
4{-# language FlexibleInstances #-}
5{-# language ScopedTypeVariables #-}
6{-# language StandaloneKindSignatures #-}
7{-# language TypeApplications #-}
8{-# language TypeFamilies #-}
9{-# language TypeOperators #-}
10{-# language UndecidableInstances #-}
12module Rel8.Schema.Reify
13 ( Reify, Col( Reify ), hreify, hunreify
20import Data.Kind ( Constraint )
21import Data.Type.Equality ( (:~:)( Refl ) )
25import Rel8.Schema.Context ( Interpretation, Col )
26import Rel8.Schema.Context.Label ( Labelable, labeler, unlabeler )
27import Rel8.Schema.HTable ( HTable, hfield, htabulate )
28import Rel8.Schema.Kind ( Context )
31type Reify :: Context -> Context
35instance Interpretation (Reify context) where
36 newtype Col (Reify context) spec = Reify (Col context spec)
39instance Labelable context => Labelable (Reify context) where
40 labeler (Reify a) = Reify (labeler a)
41 unlabeler (Reify a) = Reify (unlabeler a)
44hreify :: HTable t => t (Col context) -> t (Col (Reify context))
45hreify a = htabulate $ \field -> Reify (hfield a field)
48hunreify :: HTable t => t (Col (Reify context)) -> t (Col context)
49hunreify a = htabulate $ \field -> case hfield a field of
53type UnwrapReify :: Context -> Context
54type family UnwrapReify context where
55 UnwrapReify (Reify context) = context
58type IsReify :: Context -> Bool
59type family IsReify context where
60 IsReify (Reify _) = 'True
64type NotReify :: Context -> Constraint
65class IsReify context ~ 'False => NotReify context
66instance IsReify context ~ 'False => NotReify context
69notReify :: forall context ctx a. NotReify context => context :~: Reify ctx -> a
70notReify refl = case lemma @context of
74lemma :: NotReify context => IsReify context :~: 'False
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