
quoth Corentin Dupont
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 javascript).
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. Donn 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.