Commit 0e8d6561 authored by ecrombag's avatar ecrombag

Overloaded the assign-operator (@:). It now works for UserId, User and String (username)

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@706 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 6bf49810
......@@ -7,6 +7,8 @@ definition module CommonCombinators
import CoreCombinators, TuningCombinators, InteractionTasks
import Either
from Types import :: User (..)
// A task with a label used for labeling buttons, pulldown menus, and the like
:: LabeledTask a :== (!String,!Task a)
......@@ -25,10 +27,13 @@ eitherTask :: !(Task a) !(Task b) -> Task (Either a b) | iTask a & iTask
(-&?&-) infixr 4 :: !(Task (Maybe a)) !(Task (Maybe b)) -> Task (Maybe (a,b)) | iTask a & iTask b
//Task delegation
(@:) infix 3 :: !UserId !(LabeledTask a) -> Task a | iTask a
class (@:) infix 3 u :: u !(LabeledTask a) -> Task a | iTask a
instance @: UserId
instance @: User
instance @: String
assignByName :: !String !String !TaskPriority !(Maybe Timestamp) (Task a)
-> Task a | iTask a
assignByName :: !String !String !TaskPriority !(Maybe Timestamp) (Task a) -> Task a | iTask a
/* Handling recursion and loops:
repeatTask :: repeat Task until predicate is valid
......
......@@ -16,6 +16,7 @@ from TaskTree import :: TaskTree
import SystemTasks, InteractionTasks, UserDBTasks, CoreCombinators, TuningCombinators, LiftingCombinators
import Util, Either
import GenVisualize, GenUpdate
import Chat
derive gPrint Either
derive gParse Either
......@@ -103,8 +104,22 @@ repeatTask task pred a =
// ******************************************************************************************************
// Assigning tasks to users, each user has to be identified by an unique number >= 0
(@:) infix 3 :: !UserId !(LabeledTask a) -> Task a | iTask a
(@:) nuserId (label,task) = assign nuserId NormalPriority Nothing (task <<@ label)
instance @: UserId
where
(@:) :: !UserId !(LabeledTask a) -> Task a | iTask a
(@:) nuserId (label,task) = assign nuserId NormalPriority Nothing (task <<@ label)
instance @: User
where
(@:) :: !User !(LabeledTask a) -> Task a | iTask a
(@:) user task = user.User.userId @: task
instance @: String
where
(@:) :: String !(LabeledTask a) -> Task a | iTask a
(@:) name task
= getUserByName name
>>= \user -> user.User.userId @: task
assignByName :: !String !String !TaskPriority !(Maybe Timestamp) (Task a) -> Task a | iTask a
assignByName name subject priority deadline task
......
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