Last active
January 29, 2019 01:39
-
-
Save ELLIOTTCABLE/1fc5d8bb923a61ef5592de172b06a489 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 AType = sig | |
type t | |
end | |
module type CBAO = sig | |
type a | |
type ret | |
val call : (a -> ret) -> a -> ret | |
end | |
module Base (A : AType) : CBAO = struct | |
type a = A.t | |
type ret = unit | |
let call (f : a -> ret) (a : a) = f a | |
end | |
module rec AppliesTo : functor (A : AType) -> (functor (Ret : CBAO) -> CBAO) = | |
functor (A : AType) -> functor (Ret : CBAO) -> struct | |
type a = A.t | |
type ret = (Ret.a -> Ret.ret) | |
let call (f : a -> ret) (a : a) = f a | |
end;; | |
module M : AType with type t = int = struct type t = int end | |
module N : AType with type t = string = struct type t = string end | |
module X : CBAO = Base(M) | |
let g (_i : int) = ();; | |
X.call | |
g | |
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment