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