Sun Mar 25 11:13:25 CEST 2012
Pierce's lenses - Bidrectional programming
Bi-directional is less strict than bijective: sometimes information is
lost in one way, in which case the other direction is an update
operation that takes into account some of the information present in
the original source.
get :: S -> T
putback :: T x S -> S
get (putback (t, s)) = t
putback (get s, s) = s
+ putback (t2, putback (t1, s)) = putback (t2, s)
The last one is forgetfulness and is optional. Has to do with delete
If putback ignores the S argument it is bijective. Sometimes too
strong but nice when it holds.