Features.icl 1.42 KB
Newer Older
1
implementation module iTasks.Extensions.Device.Features
2

Haye Böhm's avatar
Fix CI  
Haye Böhm committed
3 4 5
import iTasks.SDS.Definition
import iTasks.SDS.Sources.Store
import iTasks.Internal.SDS
6 7 8 9
from iTasks.WF.Tasks.SDS import get, set
from iTasks.WF.Definition import class iTask
from iTasks.WF.Definition      import :: Task, generic gEq, generic gDefault, generic JSONDecode, generic JSONEncode, generic gText, generic gEditor, :: Editor, :: TaskId
from iTasks.Internal.Generic.Visualization    import :: TextFormat(..)
10
from Text.GenJSON import :: JSONNode, generic JSONEncode, generic JSONDecode
11
from Data.Maybe import :: Maybe
12 13 14
from iTasks.WF.Tasks.Interaction import :: UpdateOption, updateInformation
from iTasks.WF.Combinators.Common import >>-
from iTasks.WF.Combinators.Overloaded import instance Functor Task, instance TMonad Task, class TMonad(..), class TApplicative, instance TApplicative Task
15 16
from iTasks.UI.Definition import :: Hint(..)
from iTasks.UI.Tune import class tune(..), @>>, instance tune Hint Task
17 18 19
from Data.Functor import class Functor 

import StdString
20 21 22 23 24 25

derive class iTask DeviceFeatures

hasCamera :: DeviceFeatures -> Bool
hasCamera {DeviceFeatures|camera} = camera

26
device :: SimpleSDSLens DeviceFeatures
27 28 29 30 31
device = sharedStore "deviceFeaturs" {DeviceFeatures| camera = False }

manageDeviceFeaturs :: Task DeviceFeatures
manageDeviceFeaturs
	=              get device
32
	>>- \info -> Hint "Manage device features" @>> updateInformation [] info
33
	>>= \info -> set info device