[Haskell-cafe] [ANN] relational-record - relational-algebraic query building DSL

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Dec 19 16:29:15 UTC 2014

On Fri, Dec 19, 2014 at 08:07:39AM -0800, Justin Bailey wrote:
> On Fri, Dec 19, 2014 at 4:44 AM, Tom Ellis
> <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> > Opaleye uses arrows only because it is hard to implement a sensible
> > semantics otherwise.  See, for example, this bug report on HaskellDB which
> > used a monad rather than an arrow
> I'm curious how arrows make it easier to deal with aggregation? Sounds
> pretty interesting ...

They don't make it "easier" to deal with aggregation, they just avoid some
cases you don't want to have to implement.

HaskellDB allows you to write a function like

    groupByAndSum :: (Expr String, Expr Int) -> Query (Expr String, Expr Int)

and it is hard or impossible to give this sensible semantics in SQL.  (The
function you get doesn't have exactly this type because of HaskellDB's
home-rolled record types, but it is effectively this).  Arrows help avoid
this.  (Interestingly Postgres's recent LATERAL JOIN FEATURE may make the
above possible.)


More information about the Haskell-Cafe mailing list