diff options
author | Camil Staps | 2017-10-25 16:59:22 +0200 |
---|---|---|
committer | Camil Staps | 2017-10-25 16:59:22 +0200 |
commit | 418596ac5d1e508e070ebeed450fdac3589fab59 (patch) | |
tree | d044c3086a3210e711f6053b83e71a0904bd1b6e /assignment-7 | |
parent | Student numbers (diff) |
Start with assignment 7
Diffstat (limited to 'assignment-7')
-rw-r--r-- | assignment-7/appointments.icl | 48 | ||||
-rw-r--r-- | assignment-7/appointments.prj | 59 |
2 files changed, 107 insertions, 0 deletions
diff --git a/assignment-7/appointments.icl b/assignment-7/appointments.icl new file mode 100644 index 0000000..9de3c26 --- /dev/null +++ b/assignment-7/appointments.icl @@ -0,0 +1,48 @@ +module appointments + +from StdFunc import flip +from Data.Func import $ +import iTasks + +:: Appointment = + { title :: String + , when :: DateTime + , duration :: Time + , owner :: User + , participants :: [User] + } + +derive class iTask Appointment + +appointments :: Shared [Appointment] +appointments = sharedStore "appointments" [] + +Start :: *World -> *World +Start w = startEngine + ( addWorkFlows + >>| loginAndManageWorkList "Scheduler" worklist + ) w +where + addWorkFlows :: Task [Workflow] + addWorkFlows = upd (flip (++) newwfs) workflows + where + newwfs = + [ transientWorkflow "Show appointments" "Show appointments" showAppointments + , transientWorkflow "Make appointment" "Make appointment" makeAppointment + ] + + worklist :: [Workflow] + worklist = [workflow "Manage users" "Manage users" manageUsers] + +showAppointments :: Task [Appointment] +showAppointments = + get currentUser >>= \user -> + viewSharedInformation + (Title "Future appointments") + [ViewAs $ filter (\a -> a.owner == user)] + appointments + +makeAppointment :: Task [Appointment] +makeAppointment = + enterInformation (Title "Make appointment") [] >>= \app -> + upd (flip (++) [app]) appointments diff --git a/assignment-7/appointments.prj b/assignment-7/appointments.prj new file mode 100644 index 0000000..a2d8614 --- /dev/null +++ b/assignment-7/appointments.prj @@ -0,0 +1,59 @@ +Version: 1.4 +Global + ProjectRoot: . + Target: iTasks + Exec: {Project}/appointments + CodeGen + CheckStacks: False + CheckIndexes: True + Application + HeapSize: 167772160 + StackSize: 1048576 + ExtraMemory: 81920 + IntialHeapSize: 204800 + HeapSizeMultiplier: 4096 + ShowExecutionTime: False + ShowGC: False + ShowStackSize: False + MarkingCollector: False + DisableRTSFlags: False + StandardRuntimeEnv: True + Profile + Memory: False + MemoryMinimumHeapSize: 0 + Time: False + Stack: False + Dynamics: True + DescExL: False + Output + Output: ShowConstructors + Font: Monaco + FontSize: 9 + WriteStdErr: False + Link + LinkMethod: Static + GenerateRelocations: False + GenerateSymbolTable: False + GenerateLinkMap: False + LinkResources: False + ResourceSource: + GenerateDLL: False + ExportedNames: + Paths + Path: {Project} + Precompile: + Postlink: +MainModule + Name: appointments + Dir: {Project} + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False |