@@ -2,8 +2,8 @@
22
33module Rel8.Query.Exists
44 ( exists, inQuery
5− , whereExists, with, withBy
6− , whereNotExists, without, withoutBy
5+ , present, with, withBy
6+ , absent, without, withoutBy
77 )
88where
99
@@ -25,7 +25,7 @@ import Rel8.Table.Maybe ( isJustTable )
2525
2626-- | Checks if a query returns at least one row.
2727exists :: Query a -> Query (Expr Bool)
28−exists = fmap isJustTable . optional . whereExists
28+exists = fmap isJustTable . optional . present
2929-- FIXME: change this when b7aacc07c6392654cae439fc3b997620c3aa7a87 makes it
3030-- into a release of Opaleye
3131
@@ -34,23 +34,23 @@ inQuery :: EqTable a => a -> Query a -> Query (Expr Bool)
3434inQuery a = exists . (>>= filter (a ==:))
3535
3636
37−-- | Produce the empty query if the given query returns no rows. @whereExists@
37+-- | Produce the empty query if the given query returns no rows. @present@
3838-- is equivalent to @WHERE EXISTS@ in SQL.
39−whereExists :: Query a -> Query ()
40−whereExists = mapOpaleye Opaleye.restrictExists
39+present :: Query a -> Query ()
40+present = mapOpaleye Opaleye.restrictExists
4141
4242
43−-- | Produce the empty query if the given query returns rows. @whereNotExists@
43+-- | Produce the empty query if the given query returns rows. @absent@
4444-- is equivalent to @WHERE NOT EXISTS@ in SQL.
45−whereNotExists :: Query a -> Query ()
46−whereNotExists = mapOpaleye Opaleye.restrictNotExists
45+absent :: Query a -> Query ()
46+absent = mapOpaleye Opaleye.restrictNotExists
4747
4848
4949-- | @with@ is similar to 'filter', but allows the predicate to be a full query.
5050--
51−-- @with f a = a <$ whereExists (f a)@, but this form matches 'filter'.
51+-- @with f a = a <$ present (f a)@, but this form matches 'filter'.
5252with :: (a -> Query b) -> a -> Query a
53−with f a = a <$ whereExists (f a)
53+with f a = a <$ present (f a)
5454
5555
5656-- | Like @with@, but with a custom membership test.
@@ -60,7 +60,7 @@ withBy predicate bs = with $ \a -> bs >>= filter (predicate a)
6060
6161-- | Filter rows where @a -> Query b@ yields no rows.
6262without :: (a -> Query b) -> a -> Query a
63−without f a = a <$ whereNotExists (f a)
63+without f a = a <$ absent (f a)
6464
6565
6666-- | Like @without@, but with a custom membership test.