[Haskell-cafe] x -> String
andrewcoppin at btinternet.com
Fri Oct 16 14:19:46 EDT 2009
Is there any way that you can turn an arbitrary Haskell value into a string?
I rephrase: There *is* a way to turn arbitrary values into strings. I
know there is, because the GHCi debugger *does* it. The question is,
does anybody know of an /easy/ way to do this?
Basically, I'm writing a mutable container implementation. It can hold
any type of data, but it would massively aid debugging if I could
actually print out what's in it. On the other hand, I don't want to
alter the entire program to have Show constraints everywhere just so I
can print out some debug traces (and then alter everything back again
afterwards once I'm done debugging).
Anybody know of a way to do this? (As it happens, the values I'm testing
with are all Showable anyway, but the type checker doesn't know that...)
More information about the Haskell-Cafe