Skip to content

Instantly share code, notes, and snippets.

@gsg
Created January 1, 2015 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsg/4831eb4e7af755bb3344 to your computer and use it in GitHub Desktop.
Save gsg/4831eb4e7af755bb3344 to your computer and use it in GitHub Desktop.
module M = struct
type 'a key
type 'a value
type t = Univ : 'a key * 'a value -> t
type polymorphic_operations = {
conv_key : 'a . 'a key -> string;
conv_value : 'a . 'a value -> string;
}
let as_strings : type a . polymorphic_operations -> t -> (string * string) =
fun ops t -> match t with
| Univ (k, v) -> (ops.conv_key k, ops.conv_value v)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment