on master help sign in
Document name* functions
commit531d21c74d501420f672347dae9056d4dfadb67f authorOllie Charles <ollie@ocharles.org.uk> dateFri 18 Jun 2021, 16:54 (5 years ago) parentd21213d
5 files changed+43−4
src/Rel8/Table/Either.hs+12−1 src/Rel8/Table/List.hs+7−1 src/Rel8/Table/Maybe.hs+10−1 src/Rel8/Table/NonEmpty.hs+7−1 src/Rel8/Table/These.hs+7
src/Rel8/Table/Either.hs+12−1
@@ -187,7 +187,18 @@ rightTableWith :: a -> b -> EitherTable a b
187187rightTableWith = EitherTable (fromExpr (litExpr IsRight))
188188
189189
190−nameEitherTable :: Name EitherTag -> a -> b -> EitherTable a b
190+-- | Construct a 'EitherTable' in the 'Name' context. This can be useful if you
191+-- have a 'EitherTable' that you are storing in a table and need to construct a
192+-- 'TableSchema'.
193+nameEitherTable
194+ :: Name EitherTag
195+ -- ^ The name of the column to track whether a row is a 'leftTable' or
196+ -- 'rightTable'.
197+ -> a
198+ -- ^ Names of the columns in the @a@ table.
199+ -> b
200+ -- ^ Names of the columns in the @b@ table.
201+ -> EitherTable a b
191202nameEitherTable = EitherTable . fromName
192203
193204
src/Rel8/Table/List.hs+7−1
@@ -125,7 +125,13 @@ listTable =
125125 fmap toColumns
126126
127127
128−nameListTable :: Table Name a => a -> ListTable a
128+-- | Construct a 'ListTable' in the 'Name' context. This can be useful if you
129+-- have a 'ListTable' that you are storing in a table and need to construct a
130+-- 'TableSchema'.
131+nameListTable
132+ :: Table Name a
133+ => a -- ^ The names of the columns of elements of the list.
134+ -> ListTable a
129135nameListTable =
130136 ListTable .
131137 hvectorize (\_ (Identity (N (Name a))) -> N (Name a)) .
src/Rel8/Table/Maybe.hs+10−1
@@ -207,7 +207,16 @@ f $? ma@(MaybeTable _ a) = case nullable @b of
207207infixl 4 $?
208208
209209
210−nameMaybeTable :: Name (Maybe MaybeTag) -> a -> MaybeTable a
210+-- | Construct a 'MaybeTable' in the 'Name' context. This can be useful if you
211+-- have a 'MaybeTable' that you are storing in a table and need to construct a
212+-- 'TableSchema'.
213+nameMaybeTable
214+ :: Name (Maybe MaybeTag)
215+ -- ^ The name of the column to track whether a row is a 'justTable' or
216+ -- 'nothingTable'.
217+ -> a
218+ -- ^ Names of the columns in @a@.
219+ -> MaybeTable a
211220nameMaybeTable = MaybeTable . fromName
212221
213222
src/Rel8/Table/NonEmpty.hs+7−1
@@ -117,7 +117,13 @@ nonEmptyTable =
117117 fmap toColumns
118118
119119
120−nameNonEmptyTable :: Table Name a => a -> NonEmptyTable a
120+-- | Construct a 'NonEmptyTable' in the 'Name' context. This can be useful if
121+-- you have a 'NonEmptyTable' that you are storing in a table and need to
122+-- construct a 'TableSchema'.
123+nameNonEmptyTable
124+ :: Table Name a
125+ => a -- ^ The names of the columns of elements of the list.
126+ -> NonEmptyTable a
121127nameNonEmptyTable =
122128 NonEmptyTable .
123129 hvectorize (\_ (Identity (N (Name a))) -> N (Name a)) .
src/Rel8/Table/These.hs+7
@@ -247,11 +247,18 @@ theseTable f g h TheseTable {here, there} =
247247 there
248248
249249
250+-- | Construct a 'TheseTable' in the 'Name' context. This can be useful if you
251+-- have a 'TheseTable' that you are storing in a table and need to construct a
252+-- 'TableSchema'.
250253nameTheseTable :: ()
251254 => Name (Maybe MaybeTag)
255+ -- ^ The name of the column to track the presence of 'thisTable'.
252256 -> Name (Maybe MaybeTag)
257+ -- ^ The name of the column to track the presence of 'thatTable'.
253258 -> a
259+ -- ^ Names of the columns in the @a@ table.
254260 -> b
261+ -- ^ Names of the columns in the @b@ table.
255262 -> TheseTable a b
256263nameTheseTable here there a b =
257264 TheseTable