| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Control.System
Synopsis
- class Module (mod :: k) where
- data ModuleRead (mod :: k)
- data ModuleState (mod :: k)
- class WithSystem (c :: (Type -> Type) -> [Type] -> Type) (mods :: [Type]) (initEs :: [Type]) where
- withSystem :: ConsFDataList c mods => SystemInitData c mods -> EffT' c mods initEs IO a -> EffT' c ('[] :: [Type]) initEs IO a
- class EventLoop (c :: (Type -> Type) -> [Type] -> Type) mod (mods :: [Type]) (es :: [Type]) where
- beforeEvent :: EffT' c (mod ': mods) es IO ()
- afterEvent :: EffT' c (mod ': mods) es IO ()
- moduleEvent :: EffT' c (mod ': mods) es IO (STM (ModuleEvent mod))
- handleEvent :: ModuleEvent mod -> EffT' c (mod ': mods) es IO ()
- class EventLoopSystem (c :: (Type -> Type) -> [Type] -> Type) (mods :: [Type]) (es :: [Type]) where
- listenToEvents :: EffT' c mods es IO (STM (SystemEvent mods))
- handleEvents :: SystemEvent mods -> EffT' c mods es IO ()
- beforeSystem :: EffT' c mods es IO ()
- afterSystem :: EffT' c mods es IO ()
- askModule :: forall mod (mods :: [Type]) (c :: (Type -> Type) -> [Type] -> Type) (m :: Type -> Type) (es :: [Type]). (Monad m, In' c mod mods, Module mod) => EffT' c mods es m (ModuleRead mod)
- asksModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleRead mod -> a) -> EffT' c mods es m a
- queryModule :: forall mod (mods :: [Type]) (c :: (Type -> Type) -> [Type] -> Type) (m :: Type -> Type) (es :: [Type]). (Monad m, In' c mod mods, Module mod) => EffT' c mods es m (ModuleRead mod)
- queriesModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleRead mod -> a) -> EffT' c mods es m a
- localModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleRead mod -> ModuleRead mod) -> EffT' c mods es m a -> EffT' c mods es m a
- getModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type). (Monad m, In' c mod mods, Module mod) => EffT' c mods es m (ModuleState mod)
- getsModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleState mod -> a) -> EffT' c mods es m a
- putModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type). (Monad m, In' c mod mods, Module mod) => ModuleState mod -> EffT' c mods es m ()
- modifyModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type). (Monad m, In' c mod mods, Module mod) => (ModuleState mod -> ModuleState mod) -> EffT' c mods es m ()
- class Loadable (c :: (Type -> Type) -> [Type] -> Type) mod (mods :: [Type]) (ies :: [Type]) where
- withModule :: ConsFDataList c (mod ': mods) => ModuleInitData mod -> EffT' c (mod ': mods) ies IO a -> EffT' c mods ies IO a
- type family Dependency mod (deps :: [Type]) (mods :: [Type]) where ...
- type family Dependency' (c :: (Type -> Type) -> [Type] -> Type) mod (deps :: [Type]) (mods :: [Type]) where ...
- detectFlag :: String -> (String -> Either Text a) -> [String] -> Maybe (Either Text a)
- detectAllFlags :: String -> (String -> Either Text a) -> [String] -> [Either Text a]
Module and System
class Module (mod :: k) Source #
The unit of Effect, a module is a type with certain associated data family types
Instances
| Module Resource Source # | |||||||||
Defined in Module.Resource Associated Types
| |||||||||
| Module (RModule r :: Type) Source # | |||||||||
Defined in Module.RS Associated Types
| |||||||||
| Module (SModule s :: Type) Source # | |||||||||
Defined in Module.RS Associated Types
| |||||||||
| Module (RNamed name r :: Type) Source # | |||||||||
Defined in Module.RS Associated Types
| |||||||||
| Module (SNamed name s :: Type) Source # | |||||||||
Defined in Module.RS Associated Types
| |||||||||
class WithSystem (c :: (Type -> Type) -> [Type] -> Type) (mods :: [Type]) (initEs :: [Type]) where Source #
System is a list of modules loaded in sequence with dependency verification
the last module in the list is the first to be loaded and also the first to execute beforeEvent and afterEvent
Methods
withSystem :: ConsFDataList c mods => SystemInitData c mods -> EffT' c mods initEs IO a -> EffT' c ('[] :: [Type]) initEs IO a Source #
Instances
| WithSystem c ('[] :: [Type]) ies Source # | base case for system |
Defined in Control.System Methods withSystem :: ConsFDataList c ('[] :: [Type]) => SystemInitData c ('[] :: [Type]) -> EffT' c ('[] :: [Type]) ies IO a -> EffT' c ('[] :: [Type]) ies IO a Source # | |
| (SystemModule mod, WithSystem c mods ies, Loadable c mod mods ies) => WithSystem c (mod ': mods) ies Source # | Inductive instance for system |
Defined in Control.System Methods withSystem :: ConsFDataList c (mod ': mods) => SystemInitData c (mod ': mods) -> EffT' c (mod ': mods) ies IO a -> EffT' c ('[] :: [Type]) ies IO a Source # | |
class EventLoop (c :: (Type -> Type) -> [Type] -> Type) mod (mods :: [Type]) (es :: [Type]) where Source #
Minimal complete definition
Nothing
Methods
beforeEvent :: EffT' c (mod ': mods) es IO () Source #
afterEvent :: EffT' c (mod ': mods) es IO () Source #
moduleEvent :: EffT' c (mod ': mods) es IO (STM (ModuleEvent mod)) Source #
handleEvent :: ModuleEvent mod -> EffT' c (mod ': mods) es IO () Source #
Instances
| EventLoop c (RModule r) mods es Source # | |
Defined in Module.RS Methods beforeEvent :: EffT' c (RModule r ': mods) es IO () Source # afterEvent :: EffT' c (RModule r ': mods) es IO () Source # moduleEvent :: EffT' c (RModule r ': mods) es IO (STM (ModuleEvent (RModule r))) Source # handleEvent :: ModuleEvent (RModule r) -> EffT' c (RModule r ': mods) es IO () Source # | |
| EventLoop c (SModule s) mods es Source # | |
Defined in Module.RS Methods beforeEvent :: EffT' c (SModule s ': mods) es IO () Source # afterEvent :: EffT' c (SModule s ': mods) es IO () Source # moduleEvent :: EffT' c (SModule s ': mods) es IO (STM (ModuleEvent (SModule s))) Source # handleEvent :: ModuleEvent (SModule s) -> EffT' c (SModule s ': mods) es IO () Source # | |
class EventLoopSystem (c :: (Type -> Type) -> [Type] -> Type) (mods :: [Type]) (es :: [Type]) where Source #
Methods
listenToEvents :: EffT' c mods es IO (STM (SystemEvent mods)) Source #
handleEvents :: SystemEvent mods -> EffT' c mods es IO () Source #
beforeSystem :: EffT' c mods es IO () Source #
afterSystem :: EffT' c mods es IO () Source #
Instances
| EventLoopSystem c ('[] :: [Type]) es Source # | |
Defined in Control.System Methods listenToEvents :: EffT' c ('[] :: [Type]) es IO (STM (SystemEvent ('[] :: [Type]))) Source # handleEvents :: SystemEvent ('[] :: [Type]) -> EffT' c ('[] :: [Type]) es IO () Source # | |
| (SystemModule mod, EventLoop c mod mods es, EventLoopSystem c mods es) => EventLoopSystem c (mod ': mods) es Source # | |
Defined in Control.System Methods listenToEvents :: EffT' c (mod ': mods) es IO (STM (SystemEvent (mod ': mods))) Source # handleEvents :: SystemEvent (mod ': mods) -> EffT' c (mod ': mods) es IO () Source # beforeSystem :: EffT' c (mod ': mods) es IO () Source # afterSystem :: EffT' c (mod ': mods) es IO () Source # | |
read from module / get state
askModule :: forall mod (mods :: [Type]) (c :: (Type -> Type) -> [Type] -> Type) (m :: Type -> Type) (es :: [Type]). (Monad m, In' c mod mods, Module mod) => EffT' c mods es m (ModuleRead mod) Source #
The same as qeuryModule, just a synonym
asksModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleRead mod -> a) -> EffT' c mods es m a Source #
The same as queriesModule, just a synonym
queryModule :: forall mod (mods :: [Type]) (c :: (Type -> Type) -> [Type] -> Type) (m :: Type -> Type) (es :: [Type]). (Monad m, In' c mod mods, Module mod) => EffT' c mods es m (ModuleRead mod) Source #
Queries the module read inside the EffT' monad
queriesModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleRead mod -> a) -> EffT' c mods es m a Source #
Queries the module read inside the EffT' monad, using a function to extract the value
localModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleRead mod -> ModuleRead mod) -> EffT' c mods es m a -> EffT' c mods es m a Source #
Run the EffT' computation with a modified module read
getModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type). (Monad m, In' c mod mods, Module mod) => EffT' c mods es m (ModuleState mod) Source #
Get the module state inside the EffT' monad
getsModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type) a. (Monad m, In' c mod mods, Module mod) => (ModuleState mod -> a) -> EffT' c mods es m a Source #
Get the module state inside the EffT' monad, using a function to extract the value
putModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type). (Monad m, In' c mod mods, Module mod) => ModuleState mod -> EffT' c mods es m () Source #
Put the module state inside the EffT' monad
modifyModule :: forall mod (mods :: [Type]) (es :: [Type]) (m :: Type -> Type) (c :: (Type -> Type) -> [Type] -> Type). (Monad m, In' c mod mods, Module mod) => (ModuleState mod -> ModuleState mod) -> EffT' c mods es m () Source #
Modify the module state inside the EffT' monad
Loadable
class Loadable (c :: (Type -> Type) -> [Type] -> Type) mod (mods :: [Type]) (ies :: [Type]) where Source #
Run a System of EffT' given initData
Methods
withModule :: ConsFDataList c (mod ': mods) => ModuleInitData mod -> EffT' c (mod ': mods) ies IO a -> EffT' c mods ies IO a Source #
Instances
| ConsFDataList c (Resource ': mods) => Loadable c Resource mods es Source # | |
Defined in Module.Resource Methods withModule :: ConsFDataList c (Resource ': mods) => ModuleInitData Resource -> EffT' c (Resource ': mods) es IO a -> EffT' c mods es IO a Source # | |
| Loadable c (RModule r) mods ies Source # | |
Defined in Module.RS Methods withModule :: ConsFDataList c (RModule r ': mods) => ModuleInitData (RModule r) -> EffT' c (RModule r ': mods) ies IO a -> EffT' c mods ies IO a Source # | |
| Loadable c (SModule s) mods ies Source # | |
Defined in Module.RS Methods withModule :: ConsFDataList c (SModule s ': mods) => ModuleInitData (SModule s) -> EffT' c (SModule s ': mods) ies IO a -> EffT' c mods ies IO a Source # | |
type family Dependency mod (deps :: [Type]) (mods :: [Type]) where ... Source #
A type family that can be used to generate the constraints to make specifying module dependencies easier
Equations
| Dependency mod deps mods = (ConsFDataList (FData :: (Type -> Type) -> [Type] -> Type) (mod ': mods), DependencyW mod deps mods) |
type family Dependency' (c :: (Type -> Type) -> [Type] -> Type) mod (deps :: [Type]) (mods :: [Type]) where ... Source #
Equations
| Dependency' c mod deps mods = (ConsFDataList c (mod ': mods), DependencyW' c mod deps mods) |