Partial isomorphisms as described in the
paper:
Tillmann Rendel and Klaus Ostermann.
Invertible Syntax Descriptions:
Unifying Parsing and Pretty Printing.
In Proc. of Haskell Symposium, 2010.
The paper also describes invertible syntax
descriptions as a common interface for
parsers and pretty printers. These are
distributed separately in the
invertible-syntax package.