Browse thread
Newbie question: OCaml equivalent of Haskell's show?
- Antony Courtney
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Antony Courtney <antony.courtney@g...> |
| Subject: | Newbie question: OCaml equivalent of Haskell's show? |
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