Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.48 KB | None | 0 0
  1. module type TOKEN =
  2. sig
  3.         type t
  4.         val to_string : t -> string
  5. end
  6.  
  7. module Make_M (Token : TOKEN)  =
  8. struct
  9.         type t = { x : Token.t }
  10.         let create (value : Token.t) = { x = value }
  11.         let f (a : t) =
  12.                 print_endline (Token.to_string a.x)
  13. end
  14.  
  15.  
  16. module IntToken =
  17. struct
  18.         type t = int
  19.         let to_string = string_of_int
  20. end
  21.  
  22.  
  23. let () =
  24.         let module M = Make_M (IntToken) in
  25.         let z = M.create 5 in ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement