Skip to content

Instantly share code, notes, and snippets.

@m2ym
Created January 12, 2011 02:47
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 m2ym/775606 to your computer and use it in GitHub Desktop.
Save m2ym/775606 to your computer and use it in GitHub Desktop.
Haskell "deriving show" in OCaml (Concept)
type r = { name : string; age : int } with value
type t = Foo of r | Bar of int * string with value
let _ =
let t = Foo { name = "Foo"; age = 100 } in
print_endline (Value.to_string (value_of_t t))
(* => E/t/2/<Foo;E/r/2/{name:S(Foo);age:I(100)}> *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment