Created
March 20, 2015 15:42
-
-
Save gsg/9ffcae2f7e754084df10 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 CON = sig | |
type 'a t | |
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a | |
end | |
(* (stdlib) List doesn't include 'a t, add it *) | |
module ListT = struct | |
type 'a t = 'a list | |
include List | |
end | |
module Test1 (M : CON) : CON = struct | |
include M | |
end | |
module L1 = Test1 (ListT) | |
(* Would not type check *) | |
(* let _ = L1.fold_left (+) 0 [] *) | |
module Test2 (M : CON) : CON with type 'a t = 'a M.t = struct | |
include M | |
end | |
module L2 = Test2 (ListT) | |
let _ = L2.fold_left (+) 0 [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment