1{-# language DataKinds #-}
2{-# language FlexibleInstances #-}
3{-# language FunctionalDependencies #-}
4{-# language StandaloneKindSignatures #-}
5{-# language TypeFamilies #-}
6{-# language UndecidableInstances #-}
7{-# language UndecidableSuperClasses #-}
9module Rel8.Table.Recontextualize
15import Data.Functor.Identity ( Identity )
16import Data.Kind ( Constraint, Type )
17import Data.List.NonEmpty ( NonEmpty)
21import Rel8.Schema.Context ( Col )
22import Rel8.Schema.HTable ( HTable )
23import qualified Rel8.Schema.Kind as K
24import Rel8.Schema.Null ( Sql )
25import Rel8.Schema.Result ( Result )
26import Rel8.Schema.Spec ( KnownSpec )
27import Rel8.Table ( Table, Congruent )
28import Rel8.Type ( DBType )
31import Data.These ( These)
34-- | @Recontextualize from to a b@ is evidence that the types @a@ and @b@ are
35-- related, and that @b@ is the same type as @a@, but after changing the
36-- context from the initial context @from@, to the new context @to@.
37type Recontextualize :: K.Context -> K.Context -> Type -> Type -> Constraint
42 , Recontextualize from from a a
43 , Recontextualize to to b b
44 , Recontextualize to from b a
45 ) => Recontextualize from to a b
52instance Sql DBType a => Recontextualize Result Result (Identity a) (Identity a)
55instance KnownSpec spec => Recontextualize from to (Col from spec) (Col to spec)
58instance HTable t => Recontextualize from to (t (Col from)) (t (Col to))
62 ( Recontextualize from to a1 b1
63 , Recontextualize from to a2 b2
64 , from ~ Result, to ~ Result
66 => Recontextualize from to (Either a1 a2) (Either b1 b2)
69instance (Recontextualize from to a b, from ~ Result, to ~ Result) =>
70 Recontextualize from to [a] [b]
73instance (Recontextualize from to a b, from ~ Result, to ~ Result) =>
74 Recontextualize from to (Maybe a) (Maybe b)
77instance (Recontextualize from to a b, from ~ Result, to ~ Result) =>
78 Recontextualize from to (NonEmpty a) (NonEmpty b)
82 ( Recontextualize from to a1 b1
83 , Recontextualize from to a2 b2
84 , from ~ Result, to ~ Result
86 => Recontextualize from to (These a1 a2) (These b1 b2)
90 ( Recontextualize from to a1 b1
91 , Recontextualize from to a2 b2
93 => Recontextualize from to (a1, a2) (b1, b2)
97 ( Recontextualize from to a1 b1
98 , Recontextualize from to a2 b2
99 , Recontextualize from to a3 b3
101 => Recontextualize from to (a1, a2, a3) (b1, b2, b3)
105 ( Recontextualize from to a1 b1
106 , Recontextualize from to a2 b2
107 , Recontextualize from to a3 b3
108 , Recontextualize from to a4 b4
110 => Recontextualize from to (a1, a2, a3, a4) (b1, b2, b3, b4)
114 ( Recontextualize from to a1 b1
115 , Recontextualize from to a2 b2
116 , Recontextualize from to a3 b3
117 , Recontextualize from to a4 b4
118 , Recontextualize from to a5 b5
120 => Recontextualize from to (a1, a2, a3, a4, a5) (b1, b2, b3, b4, b5)
124 ( Recontextualize from to a1 b1
125 , Recontextualize from to a2 b2
126 , Recontextualize from to a3 b3
127 , Recontextualize from to a4 b4
128 , Recontextualize from to a5 b5
129 , Recontextualize from to a6 b6
131 => Recontextualize from to (a1, a2, a3, a4, a5, a6) (b1, b2, b3, b4, b5, b6)
135 ( Recontextualize from to a1 b1
136 , Recontextualize from to a2 b2
137 , Recontextualize from to a3 b3
138 , Recontextualize from to a4 b4
139 , Recontextualize from to a5 b5
140 , Recontextualize from to a6 b6
141 , Recontextualize from to a7 b7
143 => Recontextualize from to (a1, a2, a3, a4, a5, a6, a7) (b1, b2, b3, b4, b5, b6, b7)
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