Skip to content

Commit

Permalink
Tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
ocharles committed Jul 6, 2021
1 parent cbec2d9 commit d4f8aa4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Rel8/Column/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Rel8.Table.List ( ListTable )
-- | Nest a list within a 'Rel8able'. @HList f a@ will produce a 'ListTable'
-- @a@ in the 'Expr' context, and a @[a]@ in the 'Result' context.
type HList :: K.Context -> Type -> Type
type family HList context where
type family HList context = list | list -> context where
HList Aggregate = ListTable Aggregate
HList Expr = ListTable Expr
HList Name = ListTable Name
Expand Down
8 changes: 4 additions & 4 deletions src/Rel8/Table/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ instance context ~ Expr => AlternativeTable (ListTable context) where


instance (context ~ Expr, Table Expr a) => Semigroup (ListTable context a) where
as <> bs = ListTable fromColumns $
as <> bs = fromColumns $
happend (\_ _ (E a) (E b) -> E (sappend a b)) (toColumns as) (toColumns bs)


instance (context ~ Expr, Table Expr a) => Monoid (ListTable context a) where
mempty = ListTable fromColumns $ hempty $ \_ -> E . sempty
mempty = fromColumns $ hempty $ \_ -> E . sempty


-- | Construct a @ListTable@ from a list of expressions.
listTable :: Table Expr a => [a] -> ListTable Expr a
listTable =
ListTable fromColumns .
fromColumns .
hvectorize (\SSpec {info} -> E . slistOf info . fmap unE) .
fmap toColumns

Expand All @@ -207,7 +207,7 @@ nameListTable
=> a -- ^ The names of the columns of elements of the list.
-> ListTable Name a
nameListTable =
ListTable fromColumns .
fromColumns .
hvectorize (\_ (Identity (N (Name a))) -> N (Name a)) .
pure .
toColumns

0 comments on commit d4f8aa4

Please sign in to comment.