I was reading this, which said:
Well, the point is that arrow notation forbids some computations that do notation allows. In particular all “arrow actions” must be “statically” known“.
and it explains:
Statically known" means that if we have a couple of rows of arrow notation
> -- y <- action1 -< x
> -- z <- action2 -< y
then the expression action2 cannot depend on x or indeed anything bound on the left hand side of an arrow notation row.
As far as I understand, this restriction is what makes arrows worthwhile.
Now, I was trying to learn Opaleye and I noticed that it uses arrows to combine things together.
Why is Opaleye using arrows? Why are arrows a well suited thing for this job? What is it about databases/queries that make this restriction useful?
Paramaterized database queries look like arrows:
Composition (.)
(or (<<<)
) looks like an SQL subquery. (&&&)
looks like an SQL join.
I believe that the "statically known" restriction relates to things you might reasonably be able to translate into SQL. Once you allow fmap
/ lmap
/ rmap
with arbitrary Haskell functions, that isn't feasible (at least without SQL language extensions and GHC compiler plugins). I haven't worked out the details, though.
I don't know how many of the translations we might manage by hand Opaleye implements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With