Or if you really have to, using a sensible DSL to do the job instead?
Objects (or DSL) are easier to encode/decode than functions.
Also notice that Queryl is a very low level way of defining queries, and can easily become horrifying and unmaintainable with very complex queries.
The idea was to provide the low level, verbose way of defining this, and provide a user friendly frontend (as a DSL, probably) that compiles to it.
Or if you really have to, using a sensible DSL to do the job instead?