-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Using Dream with effects #297
Labels
Comments
I minimized this example (please do so! :)) to confirm that this is indeed an Lwt issue: type _ Effect.t += E : unit Effect.t
let () =
Effect.Deep.try_with
begin fun () ->
Lwt_main.run begin
Lwt.bind (Lwt_unix.sleep 1.) @@ fun () ->
Effect.perform E;
assert false
end
end
()
{
effc = fun (type a) (e : a Effect.t) ->
match e with
| E ->
Option.some @@ fun (k : (a, _) Effect.Deep.continuation) ->
prerr_endline "handling E";
Effect.Deep.continue k ()
| _ -> None
} I've opened ocsigen/lwt#1003 to ask about it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following snippet (it's not a strictly minimal example; I hope that's fine):
Making a
POST /api/users/login
request with a valid payload fails because the effect appears to be unhandled. As well as the following variation:Lwt seems at fault here, as moving
with_handlers
insidelet%lwt
or not parsing the request body at all works as expected with the second variation. Are there any tips on how to use Dream with some top-level effect handlers? Either by installing them in a way that works with Lwt or duplicating them more ergonomically than just carefully spotting all use of async API from Dream and manually inserting effect handler inside the promise handlers.The text was updated successfully, but these errors were encountered: