[Haskell-cafe] haskell idiom for reversible computations
S. Alexander Jacobson
alex at alexjacobson.com
Tue Mar 23 10:52:47 EST 2004
If I am writing a rener/parser for e.g. HTTP
Requests and Responses, I would like to be able to
guarantee that the parser really is the inverse of
the generator.
I assume that if I define a pair of computations
as reversible then I can put those computations in
some monad such that I can do:
parse = inverse generate
and
parse2 = inverse do {generate;generate2}
Actually, I assume this is an arrow rather than a
monad because a render is a computation that
takes a value and produces a value rather than
simply a computation that produces a value.
Whether its an arrow or not, I also assume this
problem is sufficiently common that there is a
well worked out idiom for this such that I don't
have to hand-code and prove inverse functions for
all my data structures. I just don't know what it
is.
-Alex-
_________________________________________________________________
S. Alexander Jacobson mailto:me at alexjacobson.com
tel:917-770-6565 http://alexjacobson.com
More information about the Haskell-Cafe
mailing list