1{-# language DataKinds #-}
2{-# language FlexibleContexts #-}
3{-# language LambdaCase #-}
4{-# language MultiParamTypeClasses #-}
5{-# language StandaloneKindSignatures #-}
6{-# language TypeFamilies #-}
7{-# language UndecidableInstances #-}
15import Data.Kind ( Type )
16import Data.Type.Equality ( (:~:)( Refl ) )
20import Rel8.Aggregate ( Aggregate )
21import Rel8.Expr ( Expr )
22import Rel8.Kind.Context ( SContext(..), Reifiable( contextSing ) )
23import Rel8.Schema.Context ( Col )
24import Rel8.Schema.HTable.List ( HListTable )
25import qualified Rel8.Schema.Kind as K
26import Rel8.Schema.Name ( Name )
27import Rel8.Schema.Reify ( Reify, hreify, hunreify )
28import Rel8.Schema.Result ( Result )
30 ( Table, Columns, Congruent, Context, fromColumns, toColumns
31 , Unreify, reify, unreify
33import Rel8.Table.List ( ListTable( ListTable ) )
34import Rel8.Table.Recontextualize ( Recontextualize )
35import Rel8.Table.Unreify ( Unreifiability(..), Unreifiable, unreifiability )
38type HList :: K.Context -> Type -> Type
39type family HList context where
40 HList (Reify context) = AHList context
41 HList Aggregate = ListTable
42 HList Expr = ListTable
43 HList Name = ListTable
47type AHList :: K.Context -> Type -> Type
48newtype AHList context a = AHList (HList context a)
51instance (Reifiable context, Unreifiable a, Table (Reify context) a) =>
52 Table (Reify context) (AHList context a)
54 type Context (AHList context a) = Reify context
55 type Columns (AHList context a) = HListTable (Columns a)
56 type Unreify (AHList context a) = HList context (Unreify a)
58 fromColumns = sfromColumnsList contextSing
59 toColumns = stoColumnsList contextSing
61 reify _ = sreifyList (unreifiability contextSing)
62 unreify _ = sunreifyList (unreifiability contextSing)
66 ( Reifiable context, Reifiable context'
67 , Unreifiable a, Unreifiable a'
68 , Recontextualize (Reify context) (Reify context') a a'
77smapList :: Congruent a b
80 -> (HListTable (Columns a) (Col (Context a)) -> HListTable (Columns b) (Col (Context b)))
84 SAggregate -> \_ f (AHList (ListTable a)) -> AHList (ListTable (f a))
85 SExpr -> \_ f (AHList (ListTable a)) -> AHList (ListTable (f a))
86 SResult -> \f _ (AHList as) -> AHList (fmap f as)
87 SName -> \_ f (AHList (ListTable a)) -> AHList (ListTable (f a))
88 SReify context -> \f g (AHList as) -> AHList (smapList context f g as)
91sfromColumnsList :: Table (Reify context) a
93 -> HListTable (Columns a) (Col (Reify context))
95sfromColumnsList = \case
96 SAggregate -> AHList . ListTable
97 SExpr -> AHList . ListTable
98 SResult -> AHList . fmap (fromColumns . hreify) . fromColumns . hunreify
99 SName -> AHList . ListTable
102 smapList context (fromColumns . hreify) hreify .
103 sfromColumnsList context .
107stoColumnsList :: Table (Reify context) a
110 -> HListTable (Columns a) (Col (Reify context))
111stoColumnsList = \case
112 SAggregate -> \(AHList (ListTable a)) -> a
113 SExpr -> \(AHList (ListTable a)) -> a
115 hreify . toColumns . fmap (hunreify . toColumns) . (\(AHList a) -> a)
116 SName -> \(AHList (ListTable a)) -> a
119 stoColumnsList context .
120 smapList context (hunreify . toColumns) hunreify .
124sreifyList :: Table (Reify context) a
125 => Unreifiability context a
126 -> HList context (Unreify a)
129 UResult -> AHList . fmap (reify Refl)
130 Unreifiability context ->
131 smapList context (reify Refl) hreify .
135sunreifyList :: Table (Reify context) a
136 => Unreifiability context a
138 -> HList context (Unreify a)
140 UResult -> fmap (unreify Refl) . (\(AHList a) -> a)
141 Unreifiability context ->
143 smapList context (unreify Refl) hunreify
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