Commit b422279f authored by Bas Lijnse's avatar Bas Lijnse

Started with reorganization of the examples.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@498 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 6fcb35e9
module AllExamples
import iTasks
//Miscellaneous examples
import Coffeemachine
import Newsgroups
import ExceptionHandling
Start :: *World -> *World
Start world = startEngine workflows world
where
workflows = flatten [ coffeemachineExample
, newsgroupsExample
, exceptionHandlingExample
]
\ No newline at end of file
definition module Coffeemachine
// (c) MJP 2007
//
// This is a demo of a coffeemachine programmed with iTasks combinators.
// The persistent variant remembers the state in which the coffee machine was left.
// Garbage collection of unused tasks is done automatically.
// Some alternative coffee machine definitions have been added as example for the ICFP07 paper.
import iTasks
coffeemachineExample :: [Workflow]
\ No newline at end of file
module coffeemachine
implementation module Coffeemachine
// (c) MJP 2007
//
......@@ -11,10 +11,14 @@ module coffeemachine
import StdList
import iTasks, iDataTrivial
Start world = startEngine [{name = "coffeemachine",label="Coffeemachine",roles=[],mainTask=(foreverTask CoffeeMachine) #>> return_V Void}] world
CoffeeMachine :: Task (String,Int)
CoffeeMachine
coffeemachineExample :: [Workflow]
coffeemachineExample = [{ name = "Examples/Miscellaneous/Coffeemachine"
, label = ""
, roles =[]
, mainTask =(foreverTask coffeemachine) #>> return_V Void
}]
coffeemachine :: Task (String,Int)
coffeemachine
= chooseTask [Text "Choose product:",Br,Br]
[("Coffee: 100", return_V (100,"Coffee"))
,("Cappucino: 150", return_V (150,"Cappucino"))
......
module exception
implementation module ExceptionHandling
import iTasks
import StdInt, StdClass
import iTasksDB
import iTasks, iTasksDB
Start :: *World -> *World
Start world = startEngine [flow] world
//Two different exception types
:: NegativeValueException = NegativeValueException String
......@@ -16,12 +12,13 @@ derive gUpd NegativeValueException, TooLargeValueException
derive gPrint NegativeValueException, TooLargeValueException
derive gParse NegativeValueException, TooLargeValueException
flow :: Workflow
flow = { name = "exception"
, label = "Exception example"
, roles = []
, mainTask = exceptionTask
}
exceptionHandlingExample :: [Workflow]
exceptionHandlingExample
= [{ name = "Examples/Miscellaneous/Exception handling"
, label = "Exception example"
, roles = []
, mainTask = exceptionTask
}]
exceptionTask :: Task Void
exceptionTask = normalTask <^> catchNegativeValueTask <^> catchTooLargeValueTask
......
definition module Newsgroups
import iTasks
newsgroupsExample :: [Workflow]
\ No newline at end of file
module newsGroups
implementation module Newsgroups
// In this example newsgroups are created and maintained
// User 0 is the manager of the newsgroup who can create new newgroups
......@@ -20,8 +20,8 @@ import iTasks, iDataTrivial, iDataFormlib, iDataWidgets
:: Subscription :== (GroupName,Index) // last message read in corresponding group
:: Index :== Int // 0 <= index < length newsgroup
:: EMail = { to :: !DisplayMode !String
, mailFrom :: !DisplayMode !String
:: EMail = { to :: !DisplayMode String
, mailFrom :: !DisplayMode String
, subject :: !String
, message :: !HtmlTextarea
}
......@@ -33,31 +33,30 @@ derive gPrint EMail, EMail2
nmessage = 2
Start world = startEngine newsGroups world
newsGroups
newsgroupsExample :: [Workflow]
newsgroupsExample
= [
{ name = "add news group"
{ name = "Examples/Miscellaneous/Newsgroups/Add newsgroup"
, label = "add news group"
, roles = []
, mainTask = addNewsGroup
},
{ name = "show news groups"
{ name = "Examples/Miscellaneous/Newsgroups/Show newsgroups"
, label = "show news groups"
, roles = []
, mainTask = showNewsGroups
},
{ name = "subscribe to news group"
{ name = "Examples/Miscellaneous/Newsgroups/Subscribe to newsgroup"
, label = "subscribe to news group"
, roles = []
, mainTask = subscribeNewsGroup
},
{ name = "internal email"
{ name = "Examples/Miscellaneous/Newsgroups/Send internal email"
, label = "internal email"
, roles = []
, mainTask = internalEmail2
},
{ name = "internal emails with answers"
{ name = "Examples/Miscellaneous/Newsgroups/Send internal emails with answers"
, label = "internal emails with answers"
, roles = []
, mainTask = internalEmailResponse
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,20 +4,18 @@ module marking
// The marks are intended for user 0 who can show them
// (c) mjp 2007/2008
import StdEnv, StdiTasks, iDataTrivial
//import iTaskUtil
import iTasks, iDataTrivial
derive gForm Mark, []
derive gUpd Mark, []
derive gForm Mark
derive gUpd Mark
derive gParse Mark
derive gPrint Mark
derive gerda Mark
derive read Mark
derive write Mark
:: Mark = {userName :: String, loginId :: Int, mark :: Int, comment :: String}
Start world = startTaskEngine (marking 0 "manager") world
Start world = startEngine (marking 0 "manager") world
marking i accountname = [Text ("Welcome user " <+++ accountname),BrTag [],BrTag []] !>> respond i accountname
where
......
......@@ -60,7 +60,7 @@ MainModule
Y: 51
SizeX: 1201
SizeY: 577
IclOpen: True
IclOpen: False
OtherModules
Module
Name: ThreadTableHandler
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -60,7 +60,7 @@ MainModule
Y: 26
SizeX: 1123
SizeY: 557
IclOpen: True
IclOpen: False
OtherModules
Module
Name: DeauthenticationHandler
......
......@@ -8,12 +8,12 @@ import StdListExt, database, iTaskCombinatorsExt, ShopDSL
Start :: *World -> *World
Start world = startEngine flows world
where
flows = [ { name = "Manage catalog"
flows = [ { name = "Examples/Shop/Manage catalog"
, label = "Manage catalog"
, roles = []
, mainTask = manageCatalog defaultProduct catalogPrompt #>> return Void
}
, { name = "Browse shop"
, { name = "Examples/Shop/Browse shop"
, label = "Browse shop"
, roles = []
, mainTask = browseShop defaultCart shopPrompt cartPrompt
......
......@@ -21,4 +21,11 @@ import Engine // basic iTask system creator
, ExceptionCombinators // Handling exceptional situations
, ClientCombinators // Delegating tasks to the client
, TuningCombinators // Fine tuning of tasks
, GenBimap
\ No newline at end of file
, GenBimap
//StdEnv modules
, StdInt
, StdString
, StdList
, StdOrdList
, StdOverloaded
\ No newline at end of file
Markdown is supported
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