BCValue is existential now
[mTask.git] / Utils / SDS.icl
1 implementation module Utils.SDS
2
3 import iTasks
4 import iTasks._Framework.Store
5 import Devices.mTaskDevice
6 import Shares.mTaskShare
7 import Tasks.Examples
8 import qualified Data.Map as DM
9 from Data.Func import $
10
11 memoryShare :: String a -> Shared a | iTask a
12 memoryShare s d = sdsFocus s $ memoryStore "" $ Just d
13
14 deviceStore :: Shared [MTaskDevice]
15 deviceStore = sharedStore "mTaskDevices" []
16
17 sdsStore :: Shared [MTaskShare]
18 sdsStore = memoryShare "mTaskShares" []
19
20 bcStateStore :: Shared BCState
21 bcStateStore = memoryShare "mTaskBCState" zero
22
23 mTaskTaskStore :: Shared [String]
24 mTaskTaskStore = memoryShare "mTaskTasks" $ 'DM'.keys allmTasks
25
26 getSDSRecord :: Int -> Task MTaskShare
27 getSDSRecord i = get sdsStore @ \l->hd [s\\s<-l | s.identifier == i]