-
-
Save steinuil/12e82304e5bce1badde3f9561cb1ef45 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
module type Thing = sig | |
type 'a off | |
type 'a on | |
val create : 'a -> 'a off | |
val run : 'a off -> 'a on | |
end | |
module Thing : Thing = struct | |
type 'a off = Off of 'a | |
type 'a on = On of 'a | |
let create x = Off x | |
let run (Off x) = | |
(* ... *) | |
On x | |
end | |
type record = { field : string } | |
let record1 = { field = "foo" } | |
let a = Thing.create record1 | |
let b = Thing.run a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment