[Haskell-cafe] Serialize to Haskell
donn at avvanta.com
Fri Aug 7 23:15:17 UTC 2015
quoth Corentin Dupont <corentin.dupont at gmail.com>
> I want to do exactly what you would do with a JSON file (read, write), but
> with a data format that would be valid Haskell (instead of valid
OK, but I think this doesn't do much to clear up the mystery.
Why valid Haskell?
That will shed a lot of light on what you really want. You know
you can write and read any value that supports Read and Show classes,
but there's more valid Haskell that isn't values at all, like the
type declarations in your example. And the module declaration,
not sure whether that's in any sense a value but I don't think
it's going to support Read or Show.
The applications I can think of don't need type declarations, and
the module would complicate things at best.
PS - if you're happy to simply read and write values, next I think
it would probably be prudent to verify that this scales to whatever
you have in mind, I mean very large values might be more efficiently
processed in some other way.
More information about the Haskell-Cafe