Are you familiar with type-conv and the family of syntax-extensions that go along with it? You can do thinks like: type t = { foo: int; bar: string } with sexp, compare, bin_io and automatically get sexp-conversion functions, a comparison function, and binary protocol converters. And type-conv has been used to build other type-directed functions by other people outside of Jane Street. The latest version is available on bitbucket, and we'll have a new blessed release in a few days. https://bitbucket.org/yminsky/ocaml-core/ Note that this is done purely syntactically, and yet gets you there. y On Wed, Mar 7, 2012 at 6:49 AM, Matej Košík < 5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote: > Hi, > > I would like to print out the response of a modified Ocaml's typechecker > to various inputs. > > One way to do it would be to write a pretty-printer by hand. > > Before I do that, I would like to apply "deriving" machinery: > http://code.google.com/p/deriving/wiki/Introduction > to this (chore) job. > > In some cases I do not know what to do. > > E.g., file "types/types.mli" contains the following definition: > > and value_kind = > Val_reg > | Val_prim of Primitive.description > | Val_ivar of mutable_flag * string > | Val_self of > (Ident.t * type_expr) Meths.t ref * > (Ident.t * mutable_flag * virtual_flag * type_expr) Vars.t ref * > string * type_expr > | Val_anc of (string * Ident.t) list * string > | Val_unbound > > If I add > > deriving (Show) > > at the end of the above definition, I get an error: > > Error: Unbound module Meths.Show_t > > That is expected but I am not sure what to do. That is, I am not sure > what is the official way to "deriving"-sify the "Meth" module which > defined in the following way: > > module Meths = Map.Make(OrderedString) > > without the need to modify files "map.ml{i,}". > > Is something like that possible? > > Thank you very much in advance for any help. > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >