1{-# language DataKinds #-}
2{-# language LambdaCase #-}
3{-# language MultiParamTypeClasses #-}
4{-# language ScopedTypeVariables #-}
5{-# language StandaloneKindSignatures #-}
6{-# language TypeApplications #-}
7{-# language TypeFamilies #-}
15import Data.Kind ( Type )
16import Data.Type.Equality ( (:~:)( Refl ) )
20import Rel8.Generic.Rel8able ( GColumns )
21import Rel8.Kind.Context ( Reifiable(..), SContext(..) )
22import Rel8.Schema.Context ( Col )
23import qualified Rel8.Schema.Kind as K
24import Rel8.Schema.Reify ( Reify, hreify, hunreify )
25import Rel8.Schema.Result ( Result, absurd )
27 ( Table, Columns, Context, fromColumns, toColumns
28 , Unreify, reify, unreify, coherence, congruence
30import Rel8.Table.Rel8able ()
31import Rel8.Table.HKD ( HKD( HKD ), HKDable, fromHKD, toHKD )
32import Rel8.Table.Recontextualize ( Recontextualize )
35type Lift :: K.Context -> Type -> Type
36type family Lift context a where
37 Lift (Reify context) a = ALift context a
39 Lift context a = HKD a context
42type ALift :: K.Context -> Type -> Type
43newtype ALift context a = ALift
44 { unALift :: Lift context a
48instance (Reifiable context, HKDable a) =>
49 Table (Reify context) (ALift context a)
51 type Context (ALift context a) = Reify context
52 type Columns (ALift context a) = GColumns (HKD a)
53 type Unreify (ALift context a) = Lift context a
55 fromColumns = sfromColumnsLift contextSing
56 toColumns = stoColumnsLift contextSing
58 unreify _ (ALift a) = a
60 coherence = case contextSing @context of
61 SAggregate -> \Refl _ -> Refl
62 SExpr -> \Refl _ -> Refl
63 SName -> \Refl _ -> Refl
64 SResult -> \Refl -> absurd
65 SReify _ -> \Refl _ -> Refl
67 congruence = case contextSing @context of
68 SAggregate -> \_ _ -> Refl
71 SResult -> \Refl -> absurd
72 SReify _ -> \_ _ -> Refl
75instance (Reifiable context, Reifiable context', HKDable a) =>
83sfromColumnsLift :: HKDable a
85 -> GColumns (HKD a) (Col (Reify context))
87sfromColumnsLift = \case
88 SAggregate -> ALift . fromColumns . hunreify
89 SExpr -> ALift . fromColumns . hunreify
90 SName -> ALift . fromColumns . hunreify
91 SResult -> ALift . fromHKD . HKD . hunreify
92 SReify context -> ALift . sfromColumnsLift context . hunreify
95stoColumnsLift :: HKDable a
98 -> GColumns (HKD a) (Col (Reify context))
100 SAggregate -> hreify . toColumns . unALift
101 SExpr -> hreify . toColumns . unALift
102 SName -> hreify . toColumns . unALift
103 SResult -> hreify . (\(HKD a) -> a) . toHKD . unALift
104 SReify context -> hreify . stoColumnsLift context . unALift
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