caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Newbie question: OCaml equivalent of Haskell's show?
@ 2008-07-06 15:33 Antony Courtney
  2008-07-06 19:02 ` [Caml-list] " Richard Jones
  2008-07-06 21:09 ` Jon Harrop
  0 siblings, 2 replies; 4+ messages in thread
From: Antony Courtney @ 2008-07-06 15:33 UTC (permalink / raw)
  To: caml-list

I'm an experienced Haskell hacker trying OCaml for the first time.

One thing I am desperately searching for but have been unable to find
is some direct runtime access to the string representation of
arbitrary OCaml values.  I have written a little option pricer that
constructs a
   float option array array
in a function.  I've got a little buglet in my function so I'd like to
print the intermediate states of this value from inside the function.
How do I do that, short of writing my own recursive pretty printer /
formatter?  An OCaml form of the Haskell Show type class would be
great, but a hack to provide programmatic access to the polymorphic
pretty printer that obviously already exists in the OCaml toplevel
would be fine.

I've scoured the standard library docs, manual, tutorials and a few
books, looked at the FAQ and am amazed that I haven't found the answer
to this.  I am hopefully just missing something obvious; would be
grateful if someone could point me towards the answer!

Apologies if this belongs on ocaml-beginners.

Thanks,

     -Antony


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-07 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-06 15:33 Newbie question: OCaml equivalent of Haskell's show? Antony Courtney
2008-07-06 19:02 ` [Caml-list] " Richard Jones
2008-07-07 19:08   ` Jeremy Yallop
2008-07-06 21:09 ` Jon Harrop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).