From 09135c581aaae471f7d964bc2a3a141bef299097 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 17 Jul 2020 07:05:03 +0200 Subject: Constrain base monad to MonadCatch 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. --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 224f936..79cf9c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,12 +24,16 @@ and this project adheres to - Parsing subscriptions (the execution always fails yet). - `Error.ResponseEventStream`, `Type.Out.Resolve`, `Type.Out.Subscribe` and `Type.Out.SourceEventStream` define subscription resolvers. +- `Error.ResolverException` is an exception that can be thrown by (field value + and event stream) resolvers to signalize an error. Other exceptions will + escape. ## Changed - `Type.Out.Resolver`: Interface fields don't have resolvers, object fields have value resolvers, root subscription type resolvers need an additional resolver that creates an event stream. `Resolver` represents these differences - now and pairs a field with the function(s). + now and pairs a field with the function(s). Resolvers don't have `ExceptT`, + errors are handled with `MonadThrow`/`MonadCatch`. - All code from `Trans` is moved to `Type.Out` and exported by `Type` and `Type.Out`. - `AST.Core` contained only `Arguments` which was moved to `Type.Definition`. @@ -43,6 +47,8 @@ and this project adheres to variable names is changed back to JSON since it is a common format and it saves additional conversions. Custom format still can be used with the underlying functions (in the `Execute` module). +- The constraint of the base monad was changed to `MonadCatch` (and it implies + `MonadThrow`). ## Removed - `Trans.ActionT` is an unneeded layer of complexity. `Type.Out.Resolver` -- cgit v1.2.3