1{-# language DataKinds #-}
2{-# language FlexibleContexts #-}
3{-# language FlexibleInstances #-}
4{-# language FunctionalDependencies #-}
5{-# language StandaloneKindSignatures #-}
6{-# language TypeFamilies #-}
7{-# language UndecidableInstances #-}
8{-# language UndecidableSuperClasses #-}
10module Rel8.Table.Recontextualize
20import Data.Functor.Identity ( Identity )
21import Data.Kind ( Constraint, Type )
25import Rel8.Aggregate ( Aggregate )
26import Rel8.Expr ( Expr )
27import Rel8.Opaque ( Opaque, Opaque1 )
28import Rel8.Schema.Context ( Col', Insertion, Name, IsSpecialContext )
29import Rel8.Schema.Context.Label ( Labelable )
30import Rel8.Schema.HTable ( HTable )
31import qualified Rel8.Schema.Kind as K
32import Rel8.Schema.Nullability ( Sql )
33import Rel8.Schema.Spec ( KnownSpec )
34import Rel8.Table ( Table, Congruent )
35import Rel8.Type ( DBType )
38type Recontextualize :: K.Context -> K.Context -> Type -> Type -> Constraint
43 , Recontextualize from from a a
44 , Recontextualize to to b b
45 , Recontextualize to from b a
46 ) => Recontextualize from to a b
53instance (KnownSpec spec, x ~ IsSpecialContext from, y ~ IsSpecialContext to) =>
54 Recontextualize from to (Col' x from spec) (Col' y to spec)
57instance Sql DBType a =>
58 Recontextualize Aggregate Aggregate (Aggregate (Expr a)) (Aggregate (Expr a))
61instance Sql DBType a =>
62 Recontextualize Aggregate Expr (Aggregate (Expr a)) (Expr a)
65instance Sql DBType a =>
66 Recontextualize Aggregate Identity (Aggregate (Expr a)) (Identity a)
69instance Sql DBType a =>
70 Recontextualize Aggregate Insertion (Aggregate (Expr a)) (Insertion a)
73instance Sql DBType a =>
74 Recontextualize Aggregate Name (Aggregate (Expr a)) (Name a)
77instance Sql DBType a =>
78 Recontextualize Expr Aggregate (Expr a) (Aggregate (Expr a))
81instance Sql DBType a => Recontextualize Expr Expr (Expr a) (Expr a)
84instance Sql DBType a => Recontextualize Expr Identity (Expr a) (Identity a)
87instance Sql DBType a => Recontextualize Expr Insertion (Expr a) (Insertion a)
90instance Sql DBType a => Recontextualize Expr Name (Expr a) (Name a)
93instance Sql DBType a =>
94 Recontextualize Identity Aggregate (Identity a) (Aggregate (Expr a))
97instance Sql DBType a => Recontextualize Identity Expr (Identity a) (Expr a)
100instance Sql DBType a => Recontextualize Identity Identity (Identity a) (Identity a)
103instance Sql DBType a =>
104 Recontextualize Identity Insertion (Identity a) (Insertion a)
107instance Sql DBType a => Recontextualize Identity Name (Identity a) (Name a)
110instance Sql DBType a =>
111 Recontextualize Insertion Aggregate (Insertion a) (Aggregate (Expr a))
114instance Sql DBType a => Recontextualize Insertion Expr (Insertion a) (Expr a)
117instance Sql DBType a =>
118 Recontextualize Insertion Identity (Insertion a) (Identity a)
121instance Sql DBType a => Recontextualize Insertion Insertion (Insertion a) (Insertion a)
124instance Sql DBType a => Recontextualize Insertion Name (Insertion a) (Name a)
127instance Sql DBType a =>
128 Recontextualize Name Aggregate (Name a) (Aggregate (Expr a))
131instance Sql DBType a => Recontextualize Name Expr (Name a) (Expr a)
134instance Sql DBType a => Recontextualize Name Identity (Name a) (Identity a)
137instance Sql DBType a => Recontextualize Name Insertion (Name a) (Insertion a)
140instance Sql DBType a => Recontextualize Name Name (Name a) (Name a)
143instance Recontextualize from to (Opaque1 from a) (Opaque1 to a)
146instance (HTable t, x ~ IsSpecialContext from, y ~ IsSpecialContext to) =>
147 Recontextualize from to (t (Col' x from)) (t (Col' y to))
151 ( Table from (t from)
153 , Congruent (t from) (t to)
154 ) => Recontextualize from to (t from) (t to)
158 ( Recontextualize from to a1 b1
159 , Recontextualize from to a2 b2
162 ) => Recontextualize from to (a1, a2) (b1, b2)
166 ( Recontextualize from to a1 b1
167 , Recontextualize from to a2 b2
168 , Recontextualize from to a3 b3
169 , Labelable from, Labelable to
170 ) => Recontextualize from to (a1, a2, a3) (b1, b2, b3)
174 ( Recontextualize from to a1 b1
175 , Recontextualize from to a2 b2
176 , Recontextualize from to a3 b3
177 , Recontextualize from to a4 b4
178 , Labelable from, Labelable to
179 ) => Recontextualize from to (a1, a2, a3, a4) (b1, b2, b3, b4)
183 ( Recontextualize from to a1 b1
184 , Recontextualize from to a2 b2
185 , Recontextualize from to a3 b3
186 , Recontextualize from to a4 b4
187 , Recontextualize from to a5 b5
188 , Labelable from, Labelable to
189 ) => Recontextualize from to (a1, a2, a3, a4, a5) (b1, b2, b3, b4, b5)
192type Aggregates :: Type -> Type -> Constraint
193class Recontextualize Aggregate Expr aggregates exprs => Aggregates aggregates exprs
194instance Recontextualize Aggregate Expr aggregates exprs => Aggregates aggregates exprs
195instance {-# OVERLAPPING #-} Aggregates (Opaque1 Aggregate Opaque) (Opaque1 Expr Opaque)
198type Encodes :: Type -> Type -> Constraint
199class Recontextualize Identity Expr a exprs => Encodes a exprs
200instance Recontextualize Identity Expr a exprs => Encodes a exprs
201instance {-# OVERLAPPING #-} Encodes (Opaque1 Identity Opaque) (Opaque1 Expr Opaque)
204type Inserts :: Type -> Type -> Constraint
205class Recontextualize Expr Insertion exprs inserts => Inserts exprs inserts
206instance Recontextualize Expr Insertion exprs inserts => Inserts exprs inserts
207instance {-# OVERLAPPING #-} Inserts (Opaque1 Expr Opaque) (Opaque1 Insertion Opaque)
210type Selects :: Type -> Type -> Constraint
211class Recontextualize Name Expr names exprs => Selects names exprs
212instance Recontextualize Name Expr names exprs => Selects names exprs
213instance {-# OVERLAPPING #-} Selects (Opaque1 Name Opaque) (Opaque1 Expr Opaque)
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