
On Wed, Feb 16, 2005 at 08:27:31AM -0600, John Goerzen wrote:
You do know that the current version of WASH rebuilds the continuation by repeating all the previous steps, don't you? Until WASH can keep the
Yes. What I don't understand is why. If I have a submit button, and it is passing one value to the next function, and that value is from an entry form on the screen, why would I care about all the previous state? That's my confusion. It seems unnecessary.
That's the simplest way to rebuild the state of the process if you can't leave anything on the server (like a process or a continuation).
Yeah, that's a neat feature. I'm using it some places, too. It's probably true that I don't understand fully how to exploit it yet. (I wish that I could return something other than () from a screen too.) I just want a way to pass only what I need. Passing lots of stuff is going to make my applications painful for modem users, which unfortnuately make up a large part of the user base.
You can, you just have to use the continuation passing style. For example, if you want screen to return a value of type LotsOfStuff, you instead create a function that takes the continuation as parameter: screen :: (LotsOfStuff -> CGI ()) -> CGI () screen cont = do ask $ do ... submit ... f ... where f (F4 a b c d) = ... let stuff = ... cont stuff Of course, you have to call it appropriately: otherScreen = do .. screen (\stuff -> ...) See my contributed WASH example. It's not on the WASH website yet, probably because it requires some changes in the library. It should be easy to make it work with the current WASH release - just import CGI instead of GuaranteedCGI, and fix the types involving WithHTML. I can do this, if you're interested. You can also test the app at this address http://212.186.92.25/~tomek/TreeEdit.cgi It should be available from 08:00 to 24:00 CET. I would like to hear what you think - both about the code and the app. Best regards Tomasz -- Szukamy programisty C++ i Haskell'a: http://tinyurl.com/5mw4e