[Haskell-beginners] Using a concept from Category Theory to enable you to come back home after your function has taken you somewhere
byorgey at seas.upenn.edu
Sun Aug 5 14:37:30 CEST 2012
On Sat, Aug 04, 2012 at 05:59:59PM +0000, Costello, Roger L. wrote:
> > How to automatically get the inverse of a Haskell function?
> That's a great question. I don't know the answer to that. Anyone else have an idea?
It is not possible in general... but on the other hand you can use
parametricity to pull some cool tricks. See Janis Voigtländer's paper
from 2009, "Bidirectionalization for free!"
(http://www.iai.uni-bonn.de/~jv/popl09-2.pdf) which is a fun read.
You can even play with an implementation of it here:
More information about the Beginners