@@ -1,99 +0,0 @@
1−{-# language DataKinds #-}
2−{-# language FlexibleInstances #-}
3−{-# language FunctionalDependencies #-}
4−{-# language StandaloneKindSignatures #-}
5−{-# language TypeFamilies #-}
6−{-# language UndecidableInstances #-}
7−{-# language UndecidableSuperClasses #-}
8−
9−module Rel8.Table.Recontextualize
10− ( Recontextualize
11− )
12−where
13−
14−-- base
15−import Data.Kind ( Constraint, Type )
16−import Prelude ()
17−
18−-- rel8
19−import qualified Rel8.Schema.Kind as K
20−import Rel8.Schema.Spec ( KnownSpec )
21−import Rel8.Table ( Table, Congruent )
22−
23−
24−-- | @Recontextualize from to a b@ is evidence that the types @a@ and @b@ are
25−-- related, and that @b@ is the same type as @a@, but after changing the
26−-- context from the initial context @from@, to the new context @to@.
27−type Recontextualize :: K.Context -> K.Context -> Type -> Type -> Constraint
28−class
29− ( Table from a
30− , Table to b
31− , Congruent a b
32− , Recontextualize from from a a
33− , Recontextualize to to b b
34− , Recontextualize to from b a
35− ) => Recontextualize from to a b
36− | a -> from
37− , b -> to
38− , a to -> b
39− , b from -> a
40−
41−
42−instance KnownSpec spec => Recontextualize from to (from spec) (to spec)
43−
44−
45−instance
46− ( Recontextualize from to a1 b1
47− , Recontextualize from to a2 b2
48− )
49− => Recontextualize from to (a1, a2) (b1, b2)
50−
51−
52−instance
53− ( Recontextualize from to a1 b1
54− , Recontextualize from to a2 b2
55− , Recontextualize from to a3 b3
56− )
57− => Recontextualize from to (a1, a2, a3) (b1, b2, b3)
58−
59−
60−instance
61− ( Recontextualize from to a1 b1
62− , Recontextualize from to a2 b2
63− , Recontextualize from to a3 b3
64− , Recontextualize from to a4 b4
65− )
66− => Recontextualize from to (a1, a2, a3, a4) (b1, b2, b3, b4)
67−
68−
69−instance
70− ( Recontextualize from to a1 b1
71− , Recontextualize from to a2 b2
72− , Recontextualize from to a3 b3
73− , Recontextualize from to a4 b4
74− , Recontextualize from to a5 b5
75− )
76− => Recontextualize from to (a1, a2, a3, a4, a5) (b1, b2, b3, b4, b5)
77−
78−
79−instance
80− ( Recontextualize from to a1 b1
81− , Recontextualize from to a2 b2
82− , Recontextualize from to a3 b3
83− , Recontextualize from to a4 b4
84− , Recontextualize from to a5 b5
85− , Recontextualize from to a6 b6
86− )
87− => Recontextualize from to (a1, a2, a3, a4, a5, a6) (b1, b2, b3, b4, b5, b6)
88−
89−
90−instance
91− ( Recontextualize from to a1 b1
92− , Recontextualize from to a2 b2
93− , Recontextualize from to a3 b3
94− , Recontextualize from to a4 b4
95− , Recontextualize from to a5 b5
96− , Recontextualize from to a6 b6
97− , Recontextualize from to a7 b7
98− )
99− => Recontextualize from to (a1, a2, a3, a4, a5, a6, a7) (b1, b2, b3, b4, b5, b6, b7)