Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module type TC =
- sig
- type t
- val x : t -> t -> t
- val y : t -> unit
- end
- module X1 =
- struct
- type t = int
- let x = (+)
- let y = Printf.printf "%d\n"
- end
- (* this is 3.12.1, you can drop most most type annotations in 4.00 *)
- let f (type a) (tc : (module TC with type t = a)) (x : a) : a=
- let module M = (val tc : TC with type t = a) in
- M.x x x
- #use "tc.ml";;
- module type TC = sig type t val x : t -> t -> t val y : t -> unit end
- module X1 :
- sig type t = int val x : int -> int -> int val y : int -> unit end
- val f : (module TC with type t = 'a) -> 'a -> 'a = <fun>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement