Last active
July 28, 2019 18:14
-
-
Save Nymphium/7aa21f8b3ad4c755a924d140aa789db3 to your computer and use it in GitHub Desktop.
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
effect Id : 'a -> 'a;; | |
let handler th = | |
match th () with | |
| x -> x | |
| effect (Id v) k -> continue k v;; | |
let handler' th = | |
match th () with | |
| x -> x | |
| effect (Id (v' : int)) k -> continue k (v' + 3) | |
| effect (Id v) k -> continue k v;; | |
(* | |
File "test.ml", line 11, characters 17-27: | |
Error: This pattern matches values of type int | |
but a pattern was expected which matches values of type effect | |
*) | |
let header'' th = | |
match th () with | |
| x -> x | |
| effect (Id v) k -> v | |
(* | |
File "test.ml", line 22, characters 23-24: | |
Error: This expression has type effect but an expression was expected of type | |
'a | |
The type constructor effect would escape its scope | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment