Esqueleto now supports IN and EXISTS

Since version 0.2.9 that I’ve just released, esqueleto supports IN and EXISTS operators (and their negated counterparts). For example:

select $
from $ \person -> do
where_ $ exists $
         from $ \post -> do
         where_ (post ^. BlogPostAuthorId ==. person ^. PersonId)
return person

Enjoy! =)

PS: I’ll try to post more in the future, so keep tuned =).

This entry was posted in Haskell. Bookmark the permalink.

3 Responses to Esqueleto now supports IN and EXISTS

  1. Erik de Castro Lopo says:

    Isn’t this just the same as writing:

    select $ from $ \(person, post) ->
        where_ (post ^. BlogPostAuthorId ==. person ^. PersonId)
        return person
  2. Erik de Castro Lopo says:

    select $
    from $ \(person, post) ->
    where_ (post ^. BlogPostAuthorId ==. person ^. PersonId)
    return person

  3. Felipe Lessa says:

    Erik: I guess you can always simulate IN and EXISTS using joins, but the query may get uglier and/or more inefficient on your backend.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>