on da76712 help sign in
rel8/src/Rel8/Table/Transpose.hs
46 lines 1.1 kB history raw
1{-# language DataKinds #-}
2{-# language FlexibleInstances #-}
3{-# language FunctionalDependencies #-}
4{-# language StandaloneKindSignatures #-}
5{-# language TypeFamilies #-}
6{-# language UndecidableInstances #-}
8module Rel8.Table.Transpose
9 ( Transposes
10 )
11where
13-- base
14import Data.Kind ( Constraint, Type )
15import Prelude ()
17-- rel8
18import qualified Rel8.Schema.Kind as K
19import Rel8.Table ( Table, Transpose, Congruent )
22-- | @'Transposes' from to a b@ means that @a@ and @b@ are 'Table's, in the
23-- @from@ and @to@ contexts respectively, which share the same underlying
24-- structure. In other words, @b@ is a version of @a@ transposed from the
25-- @from@ context to the @to@ context (and vice versa).
26type Transposes :: K.Context -> K.Context -> Type -> Type -> Constraint
27class
28 ( Table from a
29 , Table to b
30 , Congruent a b
31 , b ~ Transpose to a
32 , a ~ Transpose from b
33 )
34 => Transposes from to a b
35 | a -> from
36 , b -> to
37 , a to -> b
38 , b from -> a
39instance
40 ( Table from a
41 , Table to b
42 , Congruent a b
43 , b ~ Transpose to a
44 , a ~ Transpose from b
45 )
46 => Transposes from to a b