From: "Antony Courtney" <antony.courtney@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Newbie question: OCaml equivalent of Haskell's show?
Date: Sun, 6 Jul 2008 11:33:35 -0400 [thread overview]
Message-ID: <3be64c030807060833y155230a2gaeaf0e531827ddb3@mail.gmail.com> (raw)
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
next reply other threads:[~2008-07-06 15:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-06 15:33 Antony Courtney [this message]
2008-07-06 19:02 ` [Caml-list] " Richard Jones
2008-07-07 19:08 ` Jeremy Yallop
2008-07-06 21:09 ` Jon Harrop
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3be64c030807060833y155230a2gaeaf0e531827ddb3@mail.gmail.com \
--to=antony.courtney@gmail.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox