on master help sign in
Document some
commitc6a154c20cbc0993ad78ddbac0dc7f0d47c45d23 authorOllie Charles <ollie@ocharles.org.uk> dateTue 23 Mar 2021, 16:28 (6 years ago) parenta9b44f5
1 file changed+8
src/Rel8/Query/List.hs+8
src/Rel8/Query/List.hs+8
@@ -20,6 +20,14 @@ import Rel8.Table.Maybe ( maybeTable )
2020import Rel8.Table.NonEmpty ( NonEmptyTable )
2121
2222
23+-- | Aggregate a 'Query' into a 'NonEmptyTable'. If the supplied query returns
24+-- 0 rows, this function will produce a 'Query' that is empty - that is, will
25+-- produce zero @NonEmptyTable@s. If the supplied @Query@ does return rows,
26+-- @some@ will return exactly one row, with a @NonEmptyTable@ collecting all
27+-- returned rows.
28+--
29+-- @some@ is analogous to 'Control.Applicative.some' from
30+-- @Control.Applicative@.
2331some :: Table DB a => Query a -> Query (NonEmptyTable a)
2432some = aggregate . fmap nonEmptyAgg
2533