Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.67 KB | None | 0 0
  1. module type ID = sig
  2.     type t
  3.     val of_string : string -> t
  4.     val to_string : t -> string
  5.   end
  6.  
  7. module StrId : ID =
  8.   struct
  9.     type t = string
  10.     let of_string x = x
  11.     let to_string x = x
  12.   end
  13.  
  14. module TypeId = StrId
  15. module ServiceId = StrId
  16.  
  17. (*
  18. utop # TypeId.of_string "abc";;
  19. - : ServiceId.t = <abstr>
  20.  *)
  21.  
  22. module type ID = sig
  23.     type t
  24.     val of_string : string -> t
  25.     val to_string : t -> string
  26.   end
  27.  
  28. module StrId : ID =
  29.   struct
  30.     type t = string
  31.     let of_string x = x
  32.     let to_string x = x
  33.   end
  34.  
  35. module TypeId : ID = StrId
  36. module ServiceId : ID = StrId
  37.  
  38. (*
  39. utop # TypeId.of_string "abc";;
  40. - : TypeId.t = <abstr>
  41. *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement