1{-# language FlexibleInstances #-}
2{-# language MultiParamTypeClasses #-}
3{-# language StandaloneKindSignatures #-}
4{-# language TypeFamilies #-}
5{-# language UndecidableInstances #-}
7module Rel8.Table.NonEmpty
14import Data.Kind ( Type )
18import Rel8.Expr ( Expr, Col(..) )
19import Rel8.Expr.Array ( sappend1 )
20import Rel8.Schema.HTable.NonEmpty ( HNonEmptyTable )
21import Rel8.Schema.HTable.Vectorize ( happend )
22import Rel8.Table ( Table, Context, Columns, fromColumns, toColumns )
23import Rel8.Table.Alternative ( AltTable, (<|>:) )
24import Rel8.Table.Recontextualize ( Recontextualize )
27-- | A @NonEmptyTable@ value contains one or more instances of @a@. You
28-- construct @NonEmptyTable@s with 'some' or 'nonEmptyAgg'.
29type NonEmptyTable :: Type -> Type
30newtype NonEmptyTable a =
31 NonEmptyTable (HNonEmptyTable (Columns a) (Col (Context a)))
34instance Table context a => Table context (NonEmptyTable a) where
35 type Columns (NonEmptyTable a) = HNonEmptyTable (Columns a)
36 type Context (NonEmptyTable a) = Context a
38 fromColumns = NonEmptyTable
39 toColumns (NonEmptyTable a) = a
42instance Recontextualize from to a b =>
43 Recontextualize from to (NonEmptyTable a) (NonEmptyTable b)
46instance AltTable NonEmptyTable where
50instance Table Expr a => Semigroup (NonEmptyTable a) where
51 NonEmptyTable as <> NonEmptyTable bs = NonEmptyTable $
52 happend (\_ _ (DB a) (DB b) -> DB (sappend1 a b)) as bs
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