Typed static queries

I'm opening this PR so we can discuss the current state of the implementation.
If there is a transient failure, you want the compiler to fail with an error, not just emit a warning. There's a high probability that it would fail later because the types are wrong but IMHO that is another reason not to do it. A somewhat sane approach to falling back to an untyped version would be to infer a return type of Any and still return the correct data based on the result set meta data at runtime. But we cannot do that because we need the GetResult typeclasses. The extensibility of this system is built on having them available at compile-time.