-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be able to perform unhandled effects
- Loading branch information
Showing
6 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,4 @@ | |
Fatal error: exception Miou.Still_has_children | ||
[2] | ||
$ ./t25.exe | ||
$ ./t28.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
type _ Effect.t += Foo : unit Effect.t | ||
|
||
let prgm () = | ||
let prm = Miou.call_cc @@ fun () -> Effect.perform Foo in | ||
Miou.await_exn prm | ||
|
||
let handler fn v = | ||
let open Effect.Deep in | ||
let retc = Fun.id in | ||
let exnc = raise in | ||
let effc : type c. c Effect.t -> ((c, 'a) continuation -> 'b) option = | ||
function | ||
| Foo -> Some (fun k -> continue k ()) | ||
| _ -> None | ||
in | ||
match_with fn v { retc; exnc; effc } | ||
|
||
let () = handler (fun () -> Miou.run prgm) () |