Writing a function with type 'a -> string

For debugging purposes I'd like to have a function in OCaml that converts to string arbitrary type, the debugger currently has one, but it'd be cool to have one.

The sexplib library would be perfect, but the fact is that I can't modify all the types I need to add with sexp, and I can't use camlp4 either.

Is there any such function? (It won't be on production code so I accept dirty solutions)

Something like Haskell's Show typeclass would be exactly what I mean.

Thanks for your time

6
задан ygrek 8 February 2011 в 09:26
поделиться