@@ -11,7 +11,9 @@
12module Rel8.Table.NonEmpty
12module Rel8.Table.NonEmpty
13 ( NonEmptyTable(..)
13 ( NonEmptyTable(..)
14− , nonEmptyTable, nameNonEmptyTable
16+ , nameNonEmptyTable
@@ -29,7 +31,7 @@ import Rel8.Schema.HTable.NonEmpty ( HNonEmptyTable )
29import Rel8.Schema.HTable.Vectorize
31import Rel8.Schema.HTable.Vectorize
30 ( hvectorize, hunvectorize
32 ( hvectorize, hunvectorize
32− , hproject
34+ , hproject, hcolumn
34import qualified Rel8.Schema.Kind as K
36import qualified Rel8.Schema.Kind as K
35import Rel8.Schema.Name ( Name( Name ) )
37import Rel8.Schema.Name ( Name( Name ) )
@@ -44,7 +46,9 @@ import Rel8.Table
44import Rel8.Table.Alternative ( AltTable, (<|>:) )
46import Rel8.Table.Alternative ( AltTable, (<|>:) )
45import Rel8.Table.Eq ( EqTable, eqTable )
47import Rel8.Table.Eq ( EqTable, eqTable )
46import Rel8.Table.Ord ( OrdTable, ordTable )
48import Rel8.Table.Ord ( OrdTable, ordTable )
47−import Rel8.Table.Projection ( Projectable, project, apply )
49+import Rel8.Table.Projection
50+ ( Projectable, Projecting, Projection, project, apply
48import Rel8.Table.Serialize ( ToExprs )
52import Rel8.Table.Serialize ( ToExprs )
@@ -110,6 +114,13 @@ instance (Table Expr a, context ~ Expr) => Semigroup (NonEmptyTable context a)
110 happend (const sappend1) as bs
114 happend (const sappend1) as bs
117+-- | Project a single expression out of a 'NonEmptyTable'.
118+($+) :: Projecting a (Expr b)
119+ => Projection a (Expr b) -> NonEmptyTable Expr a -> Expr (NonEmpty b)
120+f $+ NonEmptyTable a = hcolumn $ hproject (apply f) a
113-- | Construct a @NonEmptyTable@ from a non-empty list of expressions.
124-- | Construct a @NonEmptyTable@ from a non-empty list of expressions.
114nonEmptyTable :: Table Expr a => NonEmpty a -> NonEmptyTable Expr a
125nonEmptyTable :: Table Expr a => NonEmpty a -> NonEmptyTable Expr a
115nonEmptyTable =
126nonEmptyTable =