-
-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Servant.Client.Free #920
Conversation
@@ -48,3 +51,12 @@ decodedAs response contentType = do | |||
Right val -> return val | |||
where | |||
accept = toList $ contentTypes contentType | |||
|
|||
instance ClientF ~ f => RunClient (Free f) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dunno if should rather have RunClientF f => RunClient (Free f)
runRequest req = liftF (RunRequest req id) | ||
streamingRequest req = liftF (StreamingRequest req id) | ||
throwServantError = liftF . Throw | ||
catchServantError x h = go x where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not particularly correct, as RunRequest
could throw things catchable by catchServantError
too.
Is this missing a file ( |
oops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've wanted this before!
data ClientF a | ||
= RunRequest Request (Response -> a) | ||
| StreamingRequest Request (StreamingResponse -> a) | ||
| Throw ServantError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe adding a Catch
constructor would help fix the problem with catchServantError
that you mention below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch
isn't an algebraic effect. So it won't really work out well.
@jkarni @alpmestan I'd rather remove |
+1 to removing it. On my phone so can't review more carefully, but I think
that was my only concern.
…On Sunday, March 11, 2018, Oleg Grenrus ***@***.***> wrote:
@jkarni <https://github.com/jkarni> @alpmestan
<https://github.com/alpmestan> I'd rather remove catchServantError, we
don't use it itself, and I doubt anyone else
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#920 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABlKmnX93TAvSVm-jUE-AbbTY5cWkYgeks5tdUZCgaJpZM4SlqeL>
.
|
LGTM, and I don't mind the removal of |
this is useful in testing, it nothing else.