The following code is rejected:
match%lwt foo with
| exception Bar | None -> baz ()
| Some _ -> babar ()
with the error:
Exception patterns are not allowed in this position
The ppx produces the following code:
Lwt.try_bind
(fun () -> foo)
(function
| exception Bar | None -> baz ()
| Some _ -> barbar ())
(function | exn -> Lwt.reraise exn)
You may generate the following code?
Lwt.try_find
(fun () -> foo)
(function
| None -> baz ()
| Some _ -> barbar ())
(function
| exception Bar -> baz ()
| exn -> Lwt.reraise exn)
I'm not sure it's correct to duplicate the branch ;)
The following code is rejected:
with the error:
The ppx produces the following code:
You may generate the following code?
I'm not sure it's correct to duplicate the branch ;)