Commit a6356d42 authored by Jurriën Stutterheim's avatar Jurriën Stutterheim

Use hierarchical names for Clean Platform as well


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2412 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 6cf68dc1
definition module Generic
definition module Data.Generic
import StdGeneric
......@@ -7,4 +7,4 @@ fromCONS :: !(CONS x) -> x
fromRECORD :: !(RECORD x) -> x
fromFIELD :: !(FIELD x) -> x
fromPAIRX :: !(PAIR x y) -> x
fromPAIRY :: !(PAIR x y) -> y
\ No newline at end of file
fromPAIRY :: !(PAIR x y) -> y
implementation module Generic
implementation module Data.Generic
import StdGeneric, StdList
......@@ -18,4 +18,4 @@ fromPAIRX :: !(PAIR x y) -> x
fromPAIRX (PAIR x _) = x
fromPAIRY :: !(PAIR x y) -> y
fromPAIRY (PAIR _ y) = y
\ No newline at end of file
fromPAIRY (PAIR _ y) = y
definition module List
definition module Data.List
import Functor, GenEq
import Data.Functor, GenEq
unzip3 :: ![(.a,.b,.c)] -> ([.a],[.b],[.c])
unzip4 :: ![(.a,.b,.c,.d)] -> ([.a],[.b],[.c],[.d])
......@@ -12,4 +12,4 @@ intersperse :: !a ![a] -> [a]
getItems :: ![a] ![Int] -> [a]
isMemberGen :: !a !.[a] -> Bool | gEq{|*|} a
instance Functor []
\ No newline at end of file
instance Functor []
implementation module List
implementation module Data.List
import StdTuple, StdBool, StdList, StdOrdList, Functor, GenEq
import StdTuple, StdBool, StdList, StdOrdList, Data.Functor, GenEq
unzip3 :: ![(.a,.b,.c)] -> ([.a],[.b],[.c])
unzip3 [] = ([], [], [])
......@@ -48,4 +48,4 @@ isMemberGen x [] = False
instance Functor []
where
fmap f l = [f e \\ e <- l]
\ No newline at end of file
fmap f l = [f e \\ e <- l]
definition module JSON
definition module Text.JSON
/*
* This module provides functions to encode and decode any Clean data type
* to JSON format. It provides two generic functions JSONEncode and JSONDecode
......@@ -8,7 +8,7 @@ definition module JSON
* For more info about JSON see: http://www.json.org/
*/
import StdGeneric, Maybe, StdString
import StdGeneric, Data.Maybe, StdString
:: JSONNode = JSONNull
| JSONBool !Bool
......
implementation module JSON
implementation module Text.JSON
import StdGeneric, Maybe, StdList, StdOrdList, StdString, _SystemArray, StdTuple, StdBool, StdFunc, StdOverloadedList
import Text, PPrint
import StdGeneric, Data.Maybe, StdList, StdOrdList, StdString, _SystemArray, StdTuple, StdBool, StdFunc, StdOverloadedList
import Text, Text.PPrint
//Token type which is the intermediary representation during JSON parsing
:: Token = TokenInt !Int
......
......@@ -31,7 +31,7 @@ import iTasks.Framework.Engine // basic iTask system creator
, iTasks.API.Core.LayoutCombinators
// Miscellaneous machinery
, JSON // Functions for serializing/deserializing strings
, Text.JSON // Functions for serializing/deserializing strings
, iTasks.Framework.Shared // Shared data sources
, iTasks.Framework.GenVisualize // Functions for generating GUIs
, iTasks.Framework.GenUpdate // Functions for updating arbitrary values
......@@ -53,4 +53,4 @@ import iTasks.Framework.Engine // basic iTask system creator
, StdOverloaded
from StdFunc import id, const, o
from List import instance Functor []
from Data.List import instance Functor []
implementation module iTasks
import JSON
import Text.JSON
import iTasks.Framework.GenUpdate
import iTasks.Framework.GenVisualize
import iTasks.Framework.GenVerify
......@@ -5,8 +5,8 @@ definition module iTasks.API.Common.CommonCombinators
import iTasks.API.Core.CoreCombinators, iTasks.API.Core.LayoutCombinators
from iTasks.API.Core.SystemTypes import :: User
from Map import :: Map
from Either import :: Either
from Data.Map import :: Map
from Data.Either import :: Either
/**
* Infix shorthand for step combinator
......
......@@ -2,13 +2,14 @@ implementation module iTasks.API.Common.CommonCombinators
/**
* This module contains a collection of useful iTasks combinators defined in terms of the basic iTask combinators
*/
import StdBool, StdList,StdOrdList, StdTuple, StdGeneric, StdMisc, StdInt, StdClass, Text, Time, Tuple, List, Either
import StdBool, StdList,StdOrdList, StdTuple, StdGeneric, StdMisc, StdInt, StdClass
import Text, System.Time, Data.Tuple, Data.List, Data.Either
import iTasks.Framework.Util, iTasks.Framework.GenVisualize, iTasks.Framework.GenUpdate, iTasks.Framework.GenRecord
from StdFunc import id, const, o
from iTasks.API.Core.SystemTypes import :: User(..), :: Note(..)
from iTasks.Framework.TaskState import :: TaskTree(..), :: DeferredJSON
from iTasks.API.Core.SystemData import randomInt, topLevelTasks
from Map import qualified put
from Data.Map import qualified put
import iTasks.API.Core.CoreTasks, iTasks.API.Core.CoreCombinators, iTasks.API.Common.InteractionTasks, iTasks.API.Core.LayoutCombinators
......@@ -219,11 +220,11 @@ appendTopLevelTaskFor :: !worker !(Task a) -> Task TaskId | iTask a & toUserCons
appendTopLevelTaskFor worker task = appendTopLevelTask {defaultValue & worker = toUserConstraint worker} task
instance tune InWindow
where tune InWindow task = task <<@ AfterLayout (tweakAttr ('Map'.put CONTAINER_ATTRIBUTE "window"))
where tune InWindow task = task <<@ AfterLayout (tweakAttr ('Data.Map'.put CONTAINER_ATTRIBUTE "window"))
instance tune InContainer
where tune InContainer task = task <<@ AfterLayout (tweakAttr ('Map'.put CONTAINER_ATTRIBUTE "container"))
where tune InContainer task = task <<@ AfterLayout (tweakAttr ('Data.Map'.put CONTAINER_ATTRIBUTE "container"))
instance tune InPanel
where tune InPanel task = task <<@ AfterLayout (tweakAttr ('Map'.put CONTAINER_ATTRIBUTE "panel"))
where tune InPanel task = task <<@ AfterLayout (tweakAttr ('Data.Map'.put CONTAINER_ATTRIBUTE "panel"))
valToMaybe (Value v _) = Just v
valToMaybe NoValue = Nothing
......
implementation module iTasks.API.Common.DBTasks
import StdList, StdOrdList, List
import StdList, StdOrdList, Data.List
import iTasks.Framework.iTaskClass, iTasks.Framework.Task, iTasks.Framework.Shared
import iTasks.Framework.Util
from iTasks.API.Core.CoreTasks import get, set, return
......
......@@ -2,7 +2,7 @@ definition module iTasks.API.Common.ExportTasks
/**
* This module provides tasks for exporting data from a workflow to an external source
*/
import FilePath
import System.FilePath
import iTasks.API.Core.SystemTypes
import iTasks.Framework.Task
......
implementation module iTasks.API.Common.ExportTasks
import StdBool, FilePath, CSV, File, Map
import StdBool, System.FilePath, Text.CSV, System.File, Data.Map
import iTasks.Framework.IWorld, iTasks.Framework.Task, iTasks.Framework.TaskState, iTasks.Framework.TaskStore
exportDocument :: !FilePath !Document -> Task Document
......
......@@ -2,7 +2,7 @@ definition module iTasks.API.Common.ImportTasks
/**
* This module provides tasks for importing external data into a workflow.
*/
import FilePath
import System.FilePath
import iTasks.API.Core.SystemTypes
import iTasks.Framework.Task
/**
......
implementation module iTasks.API.Common.ImportTasks
import StdBool, _SystemArray, StdInt, MIME, Text, CSV, File, Map
import StdBool, _SystemArray, StdInt
import Text.Encodings.MIME, Text, Text.CSV, System.File, Data.Map
import iTasks.Framework.IWorld, iTasks.Framework.Task, iTasks.Framework.TaskState, iTasks.Framework.TaskStore
import iTasks.Framework.Util
from StdFunc import id
......
......@@ -2,10 +2,10 @@ implementation module iTasks.API.Common.InteractionTasks
from StdFunc import id, const, o, flip
from iTasks.API.Core.SystemData import null
from Tuple import appSnd
from List import isMemberGen, instance Functor []
from Time import :: Timestamp(..)
from Map import qualified get, put
from Data.Tuple import appSnd
from Data.List import isMemberGen, instance Functor []
from System.Time import :: Timestamp(..)
from Data.Map import qualified get, put
import StdBool, StdList, StdMisc, StdTuple
import iTasks.API.Core.CoreTasks, iTasks.API.Core.OptimizedCoreTasks, iTasks.API.Core.CoreCombinators
......@@ -272,7 +272,7 @@ where
view r = DivTag [] [SpanTag [StyleAttr "font-size: 30px"] [Text (visualizeAsText AsLabel r)]]
titleFromValue :: UIAttributes -> UIAttributes
titleFromValue attr = case 'Map'.get VALUE_ATTRIBUTE attr of
Just v = 'Map'.put TITLE_ATTRIBUTE v attr
titleFromValue attr = case 'Data.Map'.get VALUE_ATTRIBUTE attr of
Just v = 'Data.Map'.put TITLE_ATTRIBUTE v attr
_ = attr
......@@ -3,7 +3,7 @@ definition module iTasks.API.Core.CoreCombinators
* This is the kernel module for the specification of workflows. It contains the core set of iTasks combinators
* with which additional combinators can be defined.
*/
from Time import :: Timestamp
from System.Time import :: Timestamp
from iTasks.API.Core.LayoutCombinators import :: SetLayout, :: AfterLayout, :: ModifyLayout, :: Layout
import iTasks.Framework.Task, iTasks.Framework.Shared
......
......@@ -2,7 +2,7 @@ implementation module iTasks.API.Core.CoreCombinators
import StdList, StdTuple, StdMisc, StdBool, StdOrdList
import HTTP, GenEq, Time, Text, Func, Tuple, List
import Internet.HTTP, GenEq, System.Time, Text, Data.Func, Data.Tuple, Data.List
import iTasks.Framework.Task, iTasks.Framework.TaskState, iTasks.Framework.TaskStore, iTasks.Framework.TaskEval
import iTasks.Framework.Util, iTasks.Framework.Shared, iTasks.Framework.Store, iTasks.Framework.GenUpdate
import iTasks.Framework.iTaskClass, iTasks.Framework.UIDefinition
......@@ -10,17 +10,17 @@ import iTasks.API.Core.SystemTypes, iTasks.API.Common.InteractionTasks, iTasks.A
import iTasks.Framework.ClientSupport.ClientOverride
from Map import qualified get, put, del, newMap, toList, fromList
from Data.Map import qualified get, put, del, newMap, toList, fromList
from StdFunc import id, const, o, seq
from iTasks import JSONEncode, JSONDecode, dynamicJSONEncode, dynamicJSONDecode
from iTasks.Framework.IWorld import :: IWorld(..)
from iTasks.Framework.TaskEval import localShare, parListShare, topListShare
from iTasks.API.Core.CoreTasks import return
from SharedDataSource import write, writeFilterMsg, read, readRegister
from Data.SharedDataSource import write, writeFilterMsg, read, readRegister
derive class iTask ParallelTaskType, WorkOnStatus
noRep = TaskRep (UIControlSequence {UIControlSequence|attributes='Map'.newMap,controls=[],direction=Vertical}) []
noRep = TaskRep (UIControlSequence {UIControlSequence|attributes='Data.Map'.newMap,controls=[],direction=Vertical}) []
getNextTaskId :: *IWorld -> (!TaskId,!*IWorld)
getNextTaskId iworld=:{currentInstance,nextTaskNo} = (TaskId currentInstance nextTaskNo, {IWorld|iworld & nextTaskNo = nextTaskNo + 1})
......@@ -204,7 +204,7 @@ where
//Create initial task list
eval event repOpts (TCInit taskId ts) iworld=:{IWorld|localLists}
//Append the initial tasks to the list
# iworld = foldl append {iworld & localLists = 'Map'.put taskId [] localLists} initTasks
# iworld = foldl append {iworld & localLists = 'Data.Map'.put taskId [] localLists} initTasks
//Evaluate the parallel
= eval event repOpts (TCParallel taskId ts) iworld
where
......@@ -232,13 +232,13 @@ where
# ts = case event of
(FocusEvent focusId) = if (focusId == taskId) taskTime ts
_ = ts
= (ValueResult (Value values stable) {TaskInfo|lastEvent=ts,refreshSensitive=refreshSensitive} (finalizeRep repOpts rep) (TCParallel taskId ts),{iworld & localLists = 'Map'.put taskId (map fst entries) localLists})
= (ValueResult (Value values stable) {TaskInfo|lastEvent=ts,refreshSensitive=refreshSensitive} (finalizeRep repOpts rep) (TCParallel taskId ts),{iworld & localLists = 'Data.Map'.put taskId (map fst entries) localLists})
//Cleanup
eval event repOpts (TCDestroy (TCParallel taskId ts)) iworld=:{localLists}
# entries = fromMaybe [] ('Map'.get taskId localLists)
# entries = fromMaybe [] ('Data.Map'.get taskId localLists)
= case foldl destroyParTask (Nothing,iworld) entries of
(Nothing,iworld) = (DestroyedResult,{iworld & localLists = 'Map'.del taskId localLists}) //All destroyed
(Just (ExceptionResult e str),iworld) = (ExceptionResult e str,{iworld & localLists = 'Map'.del taskId localLists}) //An exception occurred
(Nothing,iworld) = (DestroyedResult,{iworld & localLists = 'Data.Map'.del taskId localLists}) //All destroyed
(Just (ExceptionResult e str),iworld) = (ExceptionResult e str,{iworld & localLists = 'Data.Map'.del taskId localLists}) //An exception occurred
(Just result,iworld) = (fixOverloading result initTasks (exception "Destroy failed in step"),iworld)
//Fallback
eval _ _ _ iworld
......@@ -246,12 +246,12 @@ where
evalParTasks :: !TaskId !Event !*IWorld -> (!Maybe (TaskResult [(TaskTime,TaskValue a)]),![(!TaskListEntry,!Maybe TaskRep)],!*IWorld) | iTask a
evalParTasks taskId event iworld=:{localLists,eventRoute}
= evalFrom 0 [] (fromMaybe [] ('Map'.get taskId localLists)) ('Map'.get taskId eventRoute) iworld
= evalFrom 0 [] (fromMaybe [] ('Data.Map'.get taskId localLists)) ('Data.Map'.get taskId eventRoute) iworld
where
evalFrom n acc list mbEventIndex iworld = case foldl (evalParTask taskId event mbEventIndex) (Nothing,acc,iworld) [(i,e) \\ e <- drop n list & i <- [n..]] of
(Just (ExceptionResult e str),acc,iworld) = (Just (ExceptionResult e str),acc,iworld)
(Nothing,acc,iworld=:{localLists})
# nlist = fromMaybe [] ('Map'.get taskId localLists)
# nlist = fromMaybe [] ('Data.Map'.get taskId localLists)
# lenlist = length list
| length nlist > lenlist = evalFrom lenlist acc nlist Nothing iworld //Extra branches were added -> evaluate these as well
= (Nothing,acc,iworld) //Done
......@@ -268,7 +268,7 @@ where
= info.TaskInfo.refreshSensitive //Also evaluate if the branch is refresh sensitive
| evalNeeded
//Evaluate the branch
= case 'Map'.get entryId localTasks of
= case 'Data.Map'.get entryId localTasks of
Just (Task evala :: Task a^)
# (result,iworld) = evala event {TaskRepOpts|useLayout=Nothing,afterLayout=Nothing,modLayout=Nothing,appFinalLayout=False} tree iworld
= case result of
......@@ -300,7 +300,7 @@ where
destroyParTask :: (!Maybe (TaskResult a),!*IWorld) !TaskListEntry -> (!Maybe (TaskResult a),!*IWorld) | iTask a
//Destroy embedded tasks
destroyParTask (_,iworld=:{localTasks}) {TaskListEntry|entryId,state=EmbeddedState,lastEval=ValueResult _ _ _ tree}
= case 'Map'.get entryId localTasks of
= case 'Data.Map'.get entryId localTasks of
Just (Task evala :: Task a^)
# (result,iworld) = evala RefreshEvent {TaskRepOpts|useLayout=Nothing,afterLayout=Nothing,modLayout=Nothing,appFinalLayout=False} (TCDestroy tree) iworld
= case result of
......@@ -349,14 +349,14 @@ appendTaskToList taskId=:(TaskId parent _) (parType,parTask) iworld=:{taskTime,c
Embedded
# (taskIda,iworld) = getNextTaskId iworld
# task = parTask (parListShare taskId)
= (taskIda, EmbeddedState, {iworld & localTasks = 'Map'.put taskIda (dynamic task :: Task a^) localTasks})
= (taskIda, EmbeddedState, {iworld & localTasks = 'Data.Map'.put taskIda (dynamic task :: Task a^) localTasks})
Detached management
# task = parTask (parListShare taskId)
# progress = {issuedAt=currentDateTime,issuedBy=currentUser,stable=True,firstEvent=Nothing,latestEvent=Nothing,latestAttributes='Map'.newMap}
# progress = {issuedAt=currentDateTime,issuedBy=currentUser,stable=True,firstEvent=Nothing,latestEvent=Nothing,latestAttributes='Data.Map'.newMap}
# (taskIda=:TaskId instanceNo _,iworld) = createTopTaskInstance task management currentUser parent iworld
= (taskIda,DetachedState instanceNo progress management, iworld)
# lastEval = ValueResult NoValue {TaskInfo|lastEvent=taskTime,refreshSensitive=True} noRep (TCInit taskIda taskTime)
# entry = {entryId = taskIda, state = state, lastEval = lastEval, attributes = 'Map'.newMap, createdAt = taskTime, lastEvent = taskTime, removed = False}
# entry = {entryId = taskIda, state = state, lastEval = lastEval, attributes = 'Data.Map'.newMap, createdAt = taskTime, lastEvent = taskTime, removed = False}
# iworld = storeTaskList taskId (list ++ [entry]) iworld
= (taskIda, iworld)
......@@ -369,7 +369,7 @@ where
wrap (ExceptionResult e str) = ExceptionResult e str
newAttr (ValueResult _ _ (TaskRep def _) _) = uiDefAttributes def
newAttr _ = 'Map'.newMap
newAttr _ = 'Data.Map'.newMap
maxTime cur (ValueResult _ {TaskInfo|lastEvent} _ _) = max cur lastEvent
maxTime cur _ = cur
......@@ -397,20 +397,20 @@ updateListEntry listId entryId f iworld
loadTaskList :: !TaskId !*IWorld -> (![TaskListEntry],!*IWorld)
loadTaskList taskId=:(TaskId instanceNo taskNo) iworld=:{currentInstance,localLists}
| instanceNo == currentInstance
= (fromMaybe [] ('Map'.get taskId localLists),iworld)
= (fromMaybe [] ('Data.Map'.get taskId localLists),iworld)
| otherwise
= case read (taskInstanceReduct instanceNo) iworld of
(Ok {TIReduct|lists},iworld) = (fromMaybe [] ('Map'.get taskId lists),iworld)
(Ok {TIReduct|lists},iworld) = (fromMaybe [] ('Data.Map'.get taskId lists),iworld)
(_,iworld) = ([],iworld)
storeTaskList :: !TaskId ![TaskListEntry] !*IWorld -> *IWorld
storeTaskList taskId=:(TaskId instanceNo taskNo) list iworld=:{currentInstance,localLists}
| instanceNo == currentInstance
= {iworld & localLists = 'Map'.put taskId list localLists}
= {iworld & localLists = 'Data.Map'.put taskId list localLists}
| otherwise
= case read (taskInstanceReduct instanceNo) iworld of
(Ok reduct=:{TIReduct|lists},iworld)
# (_,iworld) = write {TIReduct|reduct & lists = 'Map'.put taskId list lists} (taskInstanceReduct instanceNo) iworld
# (_,iworld) = write {TIReduct|reduct & lists = 'Data.Map'.put taskId list lists} (taskInstanceReduct instanceNo) iworld
= iworld
(_,iworld) = iworld
......@@ -503,7 +503,7 @@ where
= (DestroyedResult,iworld)
inUseDef worker
= UIControlSequence {UIControlSequence|attributes='Map'.newMap,controls=[(stringDisplay (toString worker +++ " is working on this task"),'Map'.newMap)],direction=Vertical}
= UIControlSequence {UIControlSequence|attributes='Data.Map'.newMap,controls=[(stringDisplay (toString worker +++ " is working on this task"),'Data.Map'.newMap)],direction=Vertical}
/*
* Alters the evaluation functions of a task in such a way
* that before evaluation the currentUser field in iworld is set to
......@@ -520,7 +520,7 @@ withShared :: !b !((Shared b) -> Task a) -> Task a | iTask a & iTask b
withShared initial stask = Task eval
where
eval event repOpts (TCInit taskId ts) iworld=:{localShares}
# localShares = 'Map'.put taskId (toJSON initial) localShares
# localShares = 'Data.Map'.put taskId (toJSON initial) localShares
# (taskIda,iworld) = getNextTaskId iworld
= eval event repOpts (TCShared taskId ts (TCInit taskIda ts)) {iworld & localShares = localShares}
......@@ -542,7 +542,7 @@ where
eval event repOpts (TCDestroy (TCShared taskId ts treea)) iworld //First destroy inner task, then remove shared state
# (Task evala) = stask (localShare taskId)
# (resa,iworld=:{localShares}) = evala event repOpts (TCDestroy treea) iworld
= (resa,{iworld & localShares = 'Map'.del taskId localShares})
= (resa,{iworld & localShares = 'Data.Map'.del taskId localShares})
eval _ _ _ iworld
= (exception "Corrupt task state in withShared", iworld)
......
......@@ -5,8 +5,8 @@ definition module iTasks.API.Core.CoreTasks
import iTasks.Framework.iTaskClass, iTasks.Framework.Shared
from iTasks.Framework.Task import :: Task
from Error import ::MaybeError(..)
from OSError import ::MaybeOSError, ::OSError, ::OSErrorCode, ::OSErrorMessage
from Data.Error import ::MaybeError(..)
from System.OSError import ::MaybeOSError, ::OSError, ::OSErrorCode, ::OSErrorMessage
/**
* Lifts a value to the task domain. The task finishes immediately and yields its parameter
......
implementation module iTasks.API.Core.CoreTasks
import StdList, StdBool, StdInt, StdTuple,StdMisc, Time, Error, OSError, Map, Tuple, List
import StdList, StdBool, StdInt, StdTuple,StdMisc, System.Time, Data.Error, System.OSError, Data.Map, Data.Tuple, Data.List
import qualified StdList
import iTasks.Framework.Util, iTasks.Framework.HtmlUtil
import iTasks.Framework.iTaskClass, iTasks.Framework.Task, iTasks.Framework.TaskState, iTasks.Framework.TaskEval, iTasks.Framework.TaskStore
import iTasks.Framework.UIDefinition, iTasks.Framework.Shared
import iTasks.API.Core.LayoutCombinators
from SharedDataSource import qualified read, readRegister, write, writeFilterMsg
from Data.SharedDataSource import qualified read, readRegister, write, writeFilterMsg
from StdFunc import o, id
from iTasks.Framework.IWorld import :: IWorld(..)
from iTasks.API.Core.SystemData import topLevelTasks
from Map import qualified get
from Data.Map import qualified get
return :: !a -> (Task a) | iTask a
return a = mkInstantTask (\taskId iworld-> (Ok a, iworld))
......@@ -23,7 +23,7 @@ get :: !(ReadWriteShared a w) -> Task a | iTask a
get shared = mkInstantTask eval
where
eval taskId iworld=:{taskTime}
# (val,iworld) = 'SharedDataSource'.read shared iworld
# (val,iworld) = 'Data.SharedDataSource'.read shared iworld
= case val of
Ok val = (Ok val,iworld)
Error e = (Error (dynamic (SharedException e), e), iworld)
......@@ -32,8 +32,8 @@ set :: !a !(ReadWriteShared r a) -> Task a | iTask a
set val shared = mkInstantTask eval
where
eval taskId iworld=:{taskTime,currentInstance}
//# (res,iworld) ='SharedDataSource'.writeFilterMsg val ((<>) currentInstance) shared iworld
# (res,iworld) ='SharedDataSource'.write val shared iworld
//# (res,iworld) ='Data.SharedDataSource'.writeFilterMsg val ((<>) currentInstance) shared iworld
# (res,iworld) ='Data.SharedDataSource'.write val shared iworld
= case res of
Ok _ = (Ok val,iworld)
Error e = (Error (dynamic (SharedException e), e), iworld)
......@@ -42,13 +42,13 @@ update :: !(r -> w) !(ReadWriteShared r w) -> Task w | iTask r & iTask w
update fun shared = mkInstantTask eval
where
eval taskId iworld=:{taskTime,currentInstance}
# (er, iworld) = 'SharedDataSource'.read shared iworld
# (er, iworld) = 'Data.SharedDataSource'.read shared iworld
= case er of
Error e = (Error (dynamic (SharedException e), e), iworld)
Ok r
# w = fun r
//# (er, iworld) = 'SharedDataSource'.writeFilterMsg w ((<>) currentInstance) shared iworld
# (er, iworld) = 'SharedDataSource'.write w shared iworld
//# (er, iworld) = 'Data.SharedDataSource'.writeFilterMsg w ((<>) currentInstance) shared iworld
# (er, iworld) = 'Data.SharedDataSource'.write w shared iworld
= case er of
Ok _ = (Ok w, iworld)
Error e = (Error (dynamic (SharedException e), e), iworld)
......@@ -57,7 +57,7 @@ watch :: !(ReadWriteShared r w) -> Task r | iTask r
watch shared = Task eval
where
eval event repOpts (TCInit taskId=:(TaskId instanceNo _) ts) iworld
# (val,iworld) = 'SharedDataSource'.readRegister instanceNo shared iworld
# (val,iworld) = 'Data.SharedDataSource'.readRegister instanceNo shared iworld
# res = case val of
Ok val = ValueResult (Value val False) {TaskInfo|lastEvent=ts,refreshSensitive=True}
(finalizeRep repOpts (TaskRep (UIControlSequence {UIControlSequence|attributes=newMap,controls=[],direction=Vertical}) [])) (TCInit taskId ts)
......@@ -71,7 +71,7 @@ interact :: !d !(ReadOnlyShared r) (r -> (l,v,InteractionMask)) (l r v Interacti
interact desc shared initFun refreshFun = Task eval
where
eval event repOpts (TCInit taskId=:(TaskId instanceNo _) ts) iworld
# (mbr,iworld) = 'SharedDataSource'.readRegister instanceNo shared iworld
# (mbr,iworld) = 'Data.SharedDataSource'.readRegister instanceNo shared iworld
= case mbr of
Error e = (exception e, iworld)
Ok r
......@@ -84,7 +84,7 @@ where
//Determine next v by applying edit event if applicable
# (nv,nmask,nts,iworld) = matchAndApplyEvent event taskId taskTime v mask ts iworld
//Load next r from shared value
# (mbr,iworld) = 'SharedDataSource'.readRegister instanceNo shared iworld
# (mbr,iworld) = 'Data.SharedDataSource'.readRegister instanceNo shared iworld
| isError mbr = (exception (fromError mbr),iworld)
# nr = fromOk mbr
//Apply refresh function if r or v changed
......
......@@ -3,9 +3,9 @@ definition module iTasks.API.Core.IntegrationTasks
* This module provides tasks for interaction with other systems.
*/
from Maybe import :: Maybe
from Void import :: Void
from Error import :: MaybeError, :: MaybeErrorString
from Data.Maybe import :: Maybe
from Data.Void import :: Void
from Data.Error import :: MaybeError, :: MaybeErrorString
import iTasks.Framework.iTaskClass
from iTasks.Framework.Task import :: Task
......
......@@ -2,7 +2,7 @@ implementation module iTasks.API.Core.IntegrationTasks
import StdInt, StdFile, StdTuple, StdList
import Directory, File, FilePath, Error, OSError, UrlEncoding, Text, Tuple, JSON
import System.Directory, System.File, System.FilePath, Data.Error, System.OSError, Text.Encodings.UrlEncoding, Text, Data.Tuple, Text.JSON
import iTasks.Framework.IWorld, iTasks.Framework.Task, iTasks.Framework.TaskState
import iTasks.Framework.Shared
......@@ -11,10 +11,10 @@ import iTasks.API.Common.InteractionTasks, iTasks.API.Common.CommonCombinators /
from iTasks.API.Common.ImportTasks import importTextFile
from File import qualified fileExists, readFile
from Map import qualified newMap, put
from Process import qualified ::ProcessHandle, runProcess, checkProcess,callProcess
from Process import :: ProcessHandle(..)
from System.File import qualified fileExists, readFile
from Data.Map import qualified newMap, put
from System.Process import qualified ::ProcessHandle, runProcess, checkProcess,callProcess
from System.Process import :: ProcessHandle(..)
from Email import qualified sendEmail
from Email import :: Email(..), :: EmailOption(..)
from StdFunc import o
......@@ -52,7 +52,7 @@ where
, "--process"
, cmd
: args]
# (res,world) = 'Process'.runProcess runAsync runAsyncArgs Nothing world
# (res,world) = 'System.Process'.runProcess runAsync runAsyncArgs Nothing world
# nstate = case res of
Error e = state taskId ts (Left e)
Ok _ = state taskId ts (Right outfile)
......@@ -64,12 +64,12 @@ where
//Check for its result
eval event repOpts state=:(TCBasic taskId lastEvent encv stable) iworld=:{world}
| stable
= (ValueResult (Value (fromJust (fromJSON encv)) True) {TaskInfo|lastEvent=lastEvent,refreshSensitive=False} (TaskRep (UIControlSequence {UIControlSequence|attributes='Map'.newMap,controls=[],direction=Vertical}) []) state, iworld)
= (ValueResult (Value (fromJust (fromJSON encv)) True)