on master help sign in
Document many
commitf92d8d65f55452cca0f8d0b91e9bf3dd537946b1 authorOllie Charles <ollie@ocharles.org.uk> dateTue 23 Mar 2021, 16:28 (6 years ago) parentc25e573
1 file changed+7
src/Rel8/Query/List.hs+7
src/Rel8/Query/List.hs+7
@@ -24,5 +24,12 @@ some :: Table DB a => Query a -> Query (NonEmptyTable a)
2424some = aggregate . fmap nonEmptyAgg
2525
2626
27+-- | Aggregate a 'Query' into a 'ListTable'. If the supplied query returns 0
28+-- rows, this function will produce a 'Query' that returns one row containing
29+-- the empty @ListTable@. If the supplied @Query@ does return rows, @many@ will
30+-- return exactly one row, with a @ListTable@ collecting all returned rows.
31+--
32+-- @many@ is analogous to 'Control.Applicative.many' from
33+-- @Control.Applicative@.
2734many :: Table DB a => Query a -> Query (ListTable a)
2835many = fmap (maybeTable mempty id) . optional . aggregate . fmap listAgg