[Haskell-beginners] Hudak state emulation discussion - can you give
me some idea?
Girish Bhat
girishbhat6620 at gmail.com
Tue Mar 17 05:02:24 EDT 2009
Hi Everyone,
I was going through the classic Hudak paper "Conception, Evolution,
and Application of Functional Programming".
Probably the most valuable part is towards the end where he talks
about how state is represented in Haskell.
On Page 48 of the PDF (page 406 of the ACM Computing survey volume),
he gives the following equations
"For expository purposes we would like to make the state as implicit
as possible, and thus we express the result as a composition of
higher-order functions. To facilitate this and to make the result look
as much like the original program as possible, we define the following
higher-order infix operators and functions":
1 f:=g =\s -> +fs(gs)
2 f;g =\s -> g(fs)=\s-+fs(gs)
3 f;g =\s -> g(fs)
4 goto f = f
5 f+‘g=\s-+fs+gs
6 f<‘g=\s-+fs<gs
7 if’ p c = \s + (if (p s) then (c s) else s)
Unfortunately I am unable to parse/understand what he is doing here.
My closure understanding too seems to be wonky. :)
Would someone be kind enough to translate each of the above into plain
english and explain how to read such eqns in the future?
thanks!
More information about the Beginners
mailing list