Let's have some finite recursive datastructure in Haskell. Eg.
data Tree = Node Tree Tree | Nil
I need to be able to load such datastructure from Haskell to Python, change it and return it back to Haskell.
Is there some standard/elegant way how to do it without much pain? Eg. using some directory like objects?
The easiest option is probably to go via JSON, because Haskell has easy support for saving data as JSON and Python can directly load it as dicts.
This generates rather awkward JSON though, like,
Node (Node Nil Nil) Nil
becomesIt gets much more compact with
where the equivalent
Node (Just (Node Nothing Nothing)) Nothing
is now saved as