Last active
May 19, 2019 02:44
Star
You must be signed in to star a gist
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
type a = [ `A of int ] | |
type b = [ a | `B of int ] | |
let pair (a : a) (b : b) = ([a] :> b list) @ [b] (* works fine *) | |
module type Config = sig type t end | |
module type Box = sig | |
module C : Config | |
type t = { regions : C.t list } | |
val empty : t | |
val add : C.t -> t -> t | |
val get : t -> C.t list | |
end | |
module Box (C: Config) : Box with type C.t = C.t = struct | |
module C = C | |
type t = { regions : C.t list } | |
let empty = { regions = [] } | |
let add r box = { regions = r :: box.regions } | |
let get box = box.regions | |
end | |
module ABox = Box(struct type t = a end) | |
module BBox = Box(struct type t = b end) | |
(* Error: Type ABox.t is not a subtype of BBox.t *) | |
let join (abox : ABox.t) = BBox.get (abox :> BBox.t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment