Replies: 3 comments 3 replies
-
I far prefer |
Beta Was this translation helpful? Give feedback.
-
Also in favor of |
Beta Was this translation helpful? Give feedback.
-
I wonder if there's some confusion based on the comments. Just to clarify, we're talking about these operators here: whereExists :: Query a -> Query ()
whereNotExists :: Query a -> Query () Not this operator here: exists :: Query a -> Query (Expr Bool)
semijoin :: Query a -> Query b -> Query a
semijoin a b = a *> present b antijoin :: Query a -> Query b -> Query a
antijoin a b = a *> absent b |
Beta Was this translation helpful? Give feedback.
-
@shane-circuithub proposes that we rename
whereExists
topresent
, andwhereExists
towhereNotExists
(#57). This will ultimately be a breaking change (though we would likely deprecate the existing functions and gradually remove), but we're not able to reach an agreement as to whether or not we should do this. We'd love to hear feedback to help us make a decision!Proposal: Rename
whereExists
topresent
andwhereNotExists
toabsent
.Argument for: I think the names
whereExists
and particularlywhereNotExists
are fairly unwieldy for something that corresponds to such a nice algebraic operation in the underlying relational algebra, i.e., semijoins and antijoins respectively. If they weren't just literal translations of the SQL they generate, I don't think we would have ever chosen those names for a Haskell combinator. I think it's important to have short, concise names for foundational algebraic combinators, because it leaves room for other people to come along and define variations of them with prefixes and suffixes. This is the pattern throughout most ofRel8
, withoptional
,many
, and our heavy reliance on monadic composition of queries. I don't think the nameswhereExists
andwhereNotExists
do their combinators justice. Even if users may not be familiar withpresent
andabsent
at first glance, the names do capture both what they do and their relation to each other, and I think this precision and their conciseness will allow them to be quickly internalised by users.Argument against: I think
whereExists
andwhereNotExists
appeal to intuition, assuming the user is familiar with SQL. If I'm reading Rel8 code, I can have an idea whatwhereExists
will do, whilepresent
is unfamiliar, both in SQL and Haskell (as far as I'm aware).present
is ambiguous in isolation (though unambiguous when paired withabsent
), and I worry people may interpretpresent
as "presenting" aQuery
, rather than checking for the presence of rows.Alternatives:
present
andabsent
, leavingwhereExists
andwhereNotExists
unchanged (and not deprecated).Beta Was this translation helpful? Give feedback.
All reactions