Created
April 13, 2021 17:55
-
-
Save Octachron/552d3298b3d09671d3715f8b2f205a5e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 T = sig | |
type t | |
val x: t | |
val show: t -> string | |
end | |
module Int = struct | |
type t = int | |
let x = 1 | |
let show = string_of_int | |
end | |
module String = struct | |
type t = string | |
let x = "one" | |
let show = Fun.id | |
end | |
let random (): (module T) = | |
if Random.float > 0.5 then | |
(module String) | |
else | |
(module Int) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment