The functions generating errors in the executor should be changed anyway
when we provide better error messages from the executor, with the error
location and response path. So public definitions of these functions are
deprecated now and they are replaced by more generic functions in the
executor code.
I found some issues with directive definitions:
- I couldn't use `on FIELD_DEFINITION`, I believe because `FIELD` was parsed
first in `executableDirectiveLocation`. I've combined both
`executableDirectiveLocation` and `typetypeSystemDirectiveLocation` into one
function which can reorder them to ensure every directive location gets a fair
chance at parsing.
Not actually to do with directives, some literals weren't being parsed
correctly.
- The GraphQL spec defines list to be `[]` or `[Value]`, but empty literal lists
weren't being parsed correctly because of using `some` instead of `many`.
- The GraphQL spec defines objects to be `{}` or `{Name: Value}`, but empty
literal objects had the same issue.
Let's try MonadThrow/MonadCatch. It looks nice at a first glance. The
monad transformer stack contains only the ReaderT, less lifts are
required. Exception subtyping is easier, the user can (and should)
define custom error types and throw them. And it is still possible to
use pure error handling, if someone doesn't like runtime exceptions or
need to run a query in a pure environment.
Fixes#42.