Commit 929b40eb authored by Bas Lijnse's avatar Bas Lijnse

Added a set of the most primitive (in my humble opinion) workflows that are still useful

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@691 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 0430acd0
......@@ -2,6 +2,9 @@ module AllExamples
import iTasks
//Basic workflows
import BasicWorkflows
//Business examples
import Vote
import Purchase
......@@ -36,7 +39,8 @@ import SimpleChanges
Start :: *World -> *World
Start world = startEngine workflows world
where
workflows = flatten [ voteExample
workflows = flatten [ basicWorkflows
, voteExample
, purchaseExample
, travelBookingExample
, orderProcessingExample
......
definition module BasicWorkflows
import iTasks
basicWorkflows :: [Workflow]
\ No newline at end of file
implementation module BasicWorkflows
import iTasks
import CommonDomain
basicWorkflows :: [Workflow]
basicWorkflows =
[ workflow "Basic/Basic task" basicTask
, workflow "Basic/Information task" informationTask
, workflow "Basic/Decision task" decisionTask
, workflow "Basic/Notification task" notificationTask
]
basicTask :: Task Void
basicTask = define >>= perform >>| report
where
define :: Task Note
define = enterInformation "What needs to be done?"
perform :: Note -> Task Void
perform description = showMessage description
report :: Task Void
report = showMessage "The task has been done"
informationTask :: Task Void
informationTask = define >>= perform >>= report
where
define :: Task Note
define = enterInformation "What do you want to know?"
perform :: Note -> Task Note
perform question = enterInformation question
report :: Note -> Task Void
report answer = showMessageAbout "The answer to your question is" answer
decisionTask :: Task Void
decisionTask = define >>= perform >>= report
where
define :: Task (Note,[Note])
define = enterInformation "What needs to be decided?"
-&&-
enterInformation "What are the alternatives?"
perform :: (Note,[Note]) -> Task Note
perform (question,options) = enterChoice question options
report :: Note -> Task Void
report decision = showMessageAbout "The chosen alternative is" decision
notificationTask :: Task Void
notificationTask = define >>= perform >>| report
where
define :: Task Note
define = enterInformation "What message do you want to distribute?"
perform :: Note -> Task Void
perform message = showMessage message
report :: Task Void
report = showMessage "Your message has been read"
\ No newline at end of file
......@@ -6,6 +6,7 @@ definition module CommonDomain
import GenPrint, GenParse, GenVisualize, GenUpdate
import StdString
from Html import :: HtmlTag
from InteractionTasks import class html
// Strings with special meanings
:: EmailAddress = EmailAddress String
......@@ -43,6 +44,8 @@ derive gParse EmailAddress, Password, Note, Date, Time, Currency
derive gVisualize EmailAddress, Password, Note, Date, Time, Currency
derive gUpdate EmailAddress, Password, Note, Date, Time, Currency
instance html Note
instance toString Date
instance toString Time
instance toString Currency
......
......@@ -109,6 +109,10 @@ currentDate :: !*World -> (!Date,!*World)
currentDate world
# (tm,world) = localTime world
= ({Date| day = tm.Tm.mday, mon = 1 + tm.Tm.mon, year = 1900 + tm.Tm.year},world)
instance html Note
where
html (Note msg) = [Text msg]
instance toString Time
where
......
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