In the latest happs (darcs pulled, updated
head is 0.9.1 iirc), I am experimenting with the example file in src/HAppS/Examples/HTTP1.hs.
I would like to combine state with io.
Eventually io will mean stuff like reading from a database, but for now
I'm just reading a file.
The example file HTTP1.hs has an example
that demonstrates state with macid.
I added an example that allows you to
execute arbitrary io.
I tried, but was unable to, add a handler
that combines state and io.
, h ["iohandler"] GET $ ioReadFileHandler
, h ["statehandler"] GET $ stateHandler
--, h ["ioandstatehandler"] GET $ ioAndStateHandler
.....
-- displays contents of HAPPS.hs in
current directory
ioReadFileHandler = iohandler $ readFile
"./HAppS.hs"
-- displays incremented state counter
stateHandler = ok $ \() () ->
modify (+(1::Int)) >> get >>=
respond . show
-- should combine effect of iohandler
with statehandler
-- specifically, should display contents
of HAppS.hs, and under that an incremented state handler
-- is this possible
ioAndStateHandler = undefined undefined
Is mixing state and io possible with
HAppS? If so, an example showing how to do it would be extremely helpful.
best, thomas.
---
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.