
On Fri, Dec 19, 2014 at 08:07:39AM -0800, Justin Bailey wrote:
On Fri, Dec 19, 2014 at 4:44 AM, Tom Ellis
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.) Tom