Commit 1d3d5d80 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

*** empty log message ***

parent 3e185080
......@@ -15,18 +15,43 @@ derive gUpd []
//Start world = doHtmlServer (mkflow CreateMusic) world
//Start world = doHtmlServer (mkflow (Quotation myQuotation)) world
//Start world = doHtmlServer (mkflow travel) world
Start world = doHtmlServer (mkflow test) world
Start world = doHtmlServer (mkflow test2) world
where
mkflow tasks hst
# (html,hst) = startTask tasks hst
= mkHtml "test" html hst
test2 tst
# (tb,ta,tst) = LazyTask "test" (mkTask test) tst
//# (a,tst) = ta tst
# (b,tst) = PCTask2 ( STask "Klaar1" True, STask "Klaar2" True) tst
# (b,tst) = PCTask2 ( STask "Klaar1" True, STask "Klaar2" True) tst
= (b,tst)
test tst
# (a,tst) = PTasks [ ("travel",travel)
, ("keuze2",STask "Gereed" "")
] tst
, ("keuze2",STask "Gereed" "")
] tst
= STask "Klaar" a tst
:: EenOfAnder = Naam | Woonplaats
AnalyseForm tst
# (((_,naam),(_,woonplaats),geslacht),tst)
= STask "Vul in" ((Dsp "Naam:",""),(Dsp "Woonplaats",""),False) tst
# ((_,either),tst) = STask "Kies" (Dsp geslacht,Naam) tst
= returnTask (either,if (either == Naam) naam woonplaats) tst
derive gForm EenOfAnder
derive gUpd EenOfAnder
derive gParse EenOfAnder
derive gPrint EenOfAnder
instance == EenOfAnder
where
(==) Naam Naam = True
(==) Woonplaats Woonplaats = True
(==) _ _ = False
// travel request
......
......@@ -8,6 +8,13 @@ import StdHtml
:: Task a :== St *TSt a // an interactive task
:: IDataFun a :== St *HSt (Form a) // an iData Form
LazyTask :: String (Task a) *TSt -> (Task Bool,Task (Maybe a),*TSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
derive gForm Maybe
derive gUpd Maybe
derive gPrint Maybe
derive gParse Maybe
/*
startTask :: lift iData to iTask domain
mkTask :: promote TSt state function to an interactive Task, i.e. task will only be called when it is its turn
......
......@@ -11,6 +11,34 @@ derive gPrint Niks
:: Niks = Niks // to make an empty task
// lazy task ???
LazyTask :: String (Task a) *TSt -> (Task Bool,Task (Maybe a),*TSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
LazyTask s task tst=:((j,myturn,html),hst) = LazyTask` s task (incTask tst)
where
LazyTask` s task tst=:((j,myturn,html),hst) = (BT,LT s task,incTask tst)
where
LT s task tst = mkTask (LT` s task) tst
where
LT` s task tst=:((i,myturn,html),hst)
# (todo,hst) = mkEditForm (Init,nFormId editId False) hst
| todo.value
# (a,((i,myturn,html),hst)) = task ((i,True,html),hst)
= (Just a,((i,True,html),hst))
= (Nothing,((i,True,html),hst))
BT tst = mkTask (BT`) tst
where
BT` tst=:((i,myturn,html),hst)
# (todo,hst) = mkEditForm (Init,nFormId editId False) hst
= (todo.value,incTask ((i,myturn,html<|.|>todo.form ),hst))
editId = "signal_xxx" <+++ mkTaskNr j
derive gForm Maybe
derive gUpd Maybe
derive gPrint Maybe
derive gParse Maybe
startTask :: (Task a) *HSt -> ([BodyTag],HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
startTask taska hst
......@@ -26,11 +54,11 @@ where
# tst = incTask tst // every task should first increment its tasknumber
| not myturn = (createDefault,tst) // not active, return default value
= mytask tst
where
incTask ((i,b,html),hst) = ((incTasknr i,b,html),hst)
where
incTasknr [] = [0]
incTasknr [i:is] = [i+1:is]
incTask ((i,b,html),hst) = ((incTasknr i,b,html),hst)
where
incTasknr [] = [0]
incTasknr [i:is] = [i+1:is]
returnTask :: a -> (Task a) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC a
returnTask a = \tst -> mkTask (returnTask` a) tst
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment