Commit d25afbf0 authored by László Domoszlai's avatar László Domoszlai

hide task instance creating behind task creation. adjust examples

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2585 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 88c5c770
......@@ -49,7 +49,9 @@ where
newPlanePosition ((plane,pos,time),route)
# (plane,pos) = moveAlongWayPointsDeg plane route pos time
= (plane,pos,time + 1)
viewSharedInformation
//Interact with the running simulation
interactWithSimulation :: (ReadWriteShared ([LatLng],(LatLng,Int)) [LatLng]) -> Task [LatLng]
interactWithSimulation sim
......
......@@ -208,17 +208,15 @@ taskletExamples =
,workflow "Google MAP with sharing" "Basic Google Maps functionality" tasklet1]
tasklet1
= mkInstanceId >>= \iid ->
withShared ([],Nothing) (\state ->
(mkTaskWithShared (iid, googleMapsTasklet 52.8825984009408 4.74849700927734) state updateFun @> (mapWp,state))
= withShared ([],Nothing) (\state ->
(mkTaskWithShared (googleMapsTasklet 52.8825984009408 4.74849700927734) state updateFun @> (mapWp,state))
-||-
viewSharedInformation "The waypoints are" [] state)
tasklet2
= mkInstanceId >>= \iid ->
withShared ([],Nothing) (\state ->
(mkTaskWithShared (iid, googleMapsTasklet 52.8825984009408 4.74849700927734) state updateFun @> (mapWp,state))
= withShared ([],Nothing) (\state ->
(mkTaskWithShared (googleMapsTasklet 52.8825984009408 4.74849700927734) state updateFun @> (mapWp,state))
-||-
viewSharedInformation "The waypoints are" [] state)
......@@ -226,8 +224,7 @@ updateFun (wps,plane) st = {st & waypoints = wps, plane = plane}
mapWp (Value wpp _) _ = Just wpp
tasklet4
= mkInstanceId >>= \iid ->
mkTask (iid, googleMapsTasklet 52.8825984009408 4.74849700927734)
= mkTask (googleMapsTasklet 52.8825984009408 4.74849700927734)
>>= \v -> viewInformation "The result is" [] v
//Simulate the movement of the airplane
......
......@@ -308,7 +308,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -322,7 +322,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -406,7 +406,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -434,7 +434,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -462,7 +462,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -518,7 +518,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -546,7 +546,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -1132,13 +1132,13 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenRecord
Name: iTasks.Framework.GenSpecialize
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListTypes: NoTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -1146,13 +1146,13 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenSpecialize
Name: iTasks.Framework.Generic
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -1160,7 +1160,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenUpdate
Name: iTasks.Framework.Generic.Defaults
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1174,7 +1174,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenVerify
Name: iTasks.Framework.Generic.Interaction
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1188,7 +1188,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenVisualize
Name: iTasks.Framework.Generic.Visualization
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1397,20 +1397,6 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.iTaskClass
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Module
Name: Email
Dir: {Application}\iTasks-SDK\Server\lib
......
......@@ -108,7 +108,7 @@ where
# (_,world) = jsCallObjectMethod "setTime" [hour,min,sec] myclock world
= (val,world)
*/
/*
:: Game = { board :: !TicTacToe // the current board
, names :: !Players // the current two players
, turn :: !TicTac // the player at turn
......@@ -132,7 +132,7 @@ tictactoelet t=:(board,turn) =
|value = t
,html = \id -> DivTag [IdAttr "tictactoe"] [init_board "tictactoe" t]
,handlers = [ComponentEvent "editlet" "update" onUpdate]
//:[ComponentEvent (cellId "tictactoe" c) "click" (onCellClick c) \\ c <- [{col=x,row=y} \\ x <- [0..2] & y <- [0..2] ]]]
++[ComponentEvent (cellId "tictactoe" c) "click" (onCellClick c) \\ c <- [{col=x,row=y} \\ x <- [0..2] & y <- [0..2] ]]
,genDiff = \t1 t2 -> if (t1 === t2) Nothing (Just t2)
,appDiff = \tn to -> tn
......@@ -187,7 +187,7 @@ empty_board :: TicTacToe
empty_board = repeatn 3 (repeatn 3 Clear)
test4 = updateInformation "Tic tac toe" [] (tictactoelet (empty_board,Tic))
*/
test2 = updateInformation "Test" [] (timelet (fromString "13:00:00"))
test3 = viewSharedInformation "Clock2" [] (mapRead (\t -> (timelet t,clocklet t)) currentTime)
......@@ -199,4 +199,4 @@ test3 = viewSharedInformation "Clock2" [] (mapRead (\t -> (timelet t,clocklet t)
test = updateInformation "String" [] stringlet @ (\e -> e.Editlet.value) >&> viewSharedInformation "DEBUG" []
Start :: *World -> *World
Start world = startEngine test3 world
\ No newline at end of file
Start world = startEngine test4 world
\ No newline at end of file
This diff is collapsed.
......@@ -12,9 +12,8 @@ maybeStable _ = NoValue
derive class iTask BookingInfo, Booking, MaybeError, Flight
derive gVisualizeEditor Seat
derive gHeaders Seat
derive gGridRows Seat
derive gEditor Seat
derive gEditMeta Seat
derive gUpdate Seat
derive gVerify Seat
derive gDefault Seat
......@@ -100,7 +99,7 @@ where
>>= return o fromString
*/
chooseSeat (Just f) = mkInstanceId >>= \iid -> mkTask (iid, seatTasklet)
chooseSeat (Just f) = mkTask seatTasklet
where
seatTasklet :: Tasklet (Maybe Seat) Seat
seatTasklet =
......
This diff is collapsed.
......@@ -76,8 +76,7 @@ newPlanePosition ((pos,time),(route,Just plane))
interactWithSimulation :: (Shared ([(!Real,!Real)],Maybe MovingEntity)) -> Task ([(!Real,!Real)],Maybe MovingEntity)
interactWithSimulation state
= mkInstanceId >>= \iid ->
(mkTaskWithShared (iid, googleMapsTasklet (52.8825984009408,4.74849700927734) 10) state updateFun @> (mapWp,state))
= (mkTaskWithShared (googleMapsTasklet (52.8825984009408,4.74849700927734) 10) state updateFun @> (mapWp,state))
updateFun (wps,plane) st = {st & waypoints = wps, plane = plane}
mapWp (Value wpp _) _ = Just wpp
......
......@@ -308,7 +308,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -322,7 +322,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -406,7 +406,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -434,7 +434,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -462,7 +462,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -518,7 +518,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -546,7 +546,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -1090,7 +1090,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.Engine
Name: iTasks.Framework.ClientSupport.SaplHtml
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1104,7 +1104,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenRecord
Name: iTasks.Framework.ClientSupport.Tasklet
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1118,7 +1118,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenUpdate
Name: iTasks.Framework.Engine
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1132,7 +1132,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenVerify
Name: iTasks.Framework.GenSpecialize
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1146,7 +1146,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.GenVisualize
Name: iTasks.Framework.Generic
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1160,7 +1160,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.HtmlUtil
Name: iTasks.Framework.Generic.Defaults
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1174,7 +1174,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.IWorld
Name: iTasks.Framework.Generic.Interaction
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1188,7 +1188,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.SerializationGraphCopy
Name: iTasks.Framework.Generic.Visualization
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1202,7 +1202,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.Shared
Name: iTasks.Framework.HtmlUtil
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1216,7 +1216,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.Store
Name: iTasks.Framework.IWorld
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1230,7 +1230,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.Task
Name: iTasks.Framework.SerializationGraphCopy
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1244,7 +1244,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.TaskEval
Name: iTasks.Framework.Shared
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1258,7 +1258,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.TaskServer
Name: iTasks.Framework.Store
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1272,7 +1272,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.TaskState
Name: iTasks.Framework.Task
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1286,7 +1286,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.TaskStore
Name: iTasks.Framework.TaskEval
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1300,7 +1300,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.UIDefinition
Name: iTasks.Framework.TaskServer
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1314,7 +1314,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.UIDiff
Name: iTasks.Framework.TaskState
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1328,7 +1328,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.Util
Name: iTasks.Framework.TaskStore
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1342,7 +1342,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.WebService
Name: iTasks.Framework.UIDefinition
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1356,7 +1356,7 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: iTasks.Framework.iTaskClass
Name: iTasks.Framework.UIDiff
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
......@@ -1370,8 +1370,8 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: SaplHtml
Dir: {Application}\iTasks-SDK\Server\iTasks\Framework\ClientSupport
Name: iTasks.Framework.Util
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
......@@ -1384,8 +1384,8 @@ OtherModules
ReuseUniqueNodes: True
Fusion: False
Module
Name: Tasklet
Dir: {Application}\iTasks-SDK\Server\iTasks\Framework\ClientSupport
Name: iTasks.Framework.WebService
Dir: {Application}\iTasks-SDK\Server
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
......
......@@ -59,9 +59,7 @@ newPlanePosition ((pos,time),(route,Just plane))
interactWithSimulation :: (Shared ([(!Real,!Real)],Maybe MovingEntity)) -> Task ([(!Real,!Real)],Maybe MovingEntity)
interactWithSimulation state
=
mkInstanceId >>= \iid ->
(mkTaskWithShared (iid, googleMapsTasklet (52.8825984009408,4.74849700927734) 10) state updateFun @> (mapWp,state))
= (mkTaskWithShared (googleMapsTasklet (52.8825984009408,4.74849700927734) 10) state updateFun @> (mapWp,state))
updateFun (wps,plane) st = {st & waypoints = wps, plane = plane}
mapWp (Value wpp _) _ = Just wpp
......
module Movin
import iTasks, iTasks.Framework.iTaskClass, Tasklet
import Text.StringAppender, graph_to_sapl_string
import sapldebug
import iTasks, iTasks.Framework.ClientSupport.Tasklet
//-------------------------------------------------------------------------
......@@ -41,9 +39,8 @@ derive class iTask Cmd
tasklet :: Task Void
tasklet
= mkInstanceId >>= \iid ->
withShared (SetPosX 0) (\pos ->
mkTaskWithShared (iid, movinTasklet) pos updateFun
= withShared (SetPosX 0) (\pos ->
mkTaskWithShared movinTasklet pos updateFun
-||
forever (wait 10 >>- update (moveForward 40) pos ))
where
......
This diff is collapsed.
module SharedTasklet
import iTasks, iTasks.Framework.ClientSupport.Tasklet
import Text.StringAppender, graph_to_sapl_string
import sapldebug
//-------------------------------------------------------------------------
......@@ -40,22 +38,20 @@ fromPrj _ {Scale|cur} = cur
taskletSlider :: Task Position
taskletSlider
= mkInstanceId >>= \iid ->
withShared 0 (\pos ->
= withShared 0 (\pos ->
updateSharedInformation "Adapt position" [UpdateWith toPrj fromPrj] pos
-||-
mkTaskWithShared (iid, movinTasklet) pos updateFun)
mkTaskWithShared movinTasklet pos updateFun)
where
updateFun :: Position Position -> Position
updateFun sharedval st = sharedval
tasklet :: Task Position
tasklet
= mkInstanceId >>= \iid ->
withShared 0 (\pos ->
= withShared 0 (\pos ->
updateSharedInformation "Adapt position" [] pos
-||-
mkTaskWithShared (iid, movinTasklet) pos updateFun)
mkTaskWithShared movinTasklet pos updateFun)
where
updateFun :: Position Position -> Position
updateFun sharedval st = sharedval
......
......@@ -279,7 +279,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -293,7 +293,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -377,7 +377,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -405,7 +405,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -433,7 +433,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -489,7 +489,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......@@ -517,7 +517,7 @@ OtherModules
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
......
......@@ -434,30 +434,26 @@ taskletExamples =
tasklet2 :: Task Drawing
tasklet2
= mkInstanceId >>= \iid ->
mkTask (iid, painterTasklet)
= mkTask painterTasklet
>>* [ OnValue ifStable
]
tasklet1 :: Task Int
tasklet1
= mkInstanceId >>= \iid ->
mkTask (iid, pushTasklet)
= mkTask pushTasklet
>>* [ OnAction ActionOk (ifValue (\n -> n >= 3))
]
tasklet3 :: Task (Maybe GPSCoord)
tasklet3
= mkInstanceId >>= \iid ->
mkTask (iid, geoTasklet)
= mkTask geoTasklet
>>* [ OnAction ActionOk (ifValue isJust),
OnAction ActionCancel (\_ = Nothing)