Copyright | (c) Anton Gushcha, 2015-2016 |
---|---|
License | BSD3 |
Maintainer | ncrashed@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- newtype SyncT s m a = SyncT {}
- registerSyncIdInternal :: HashableTypeRep -> SyncState s -> (Word64, SyncState s)
- addSyncTypeRepInternal :: HashableTypeRep -> Word64 -> SyncState s -> SyncState s
- syncRequestIdInternal :: forall proxy i m s. (ActorMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i) => Peer -> proxy i -> SyncState s -> m (SyncState s)
- getServiceChannel :: NetworkMonad m => m ChannelID
- syncLog :: LoggingMonad m => SyncState s -> Text -> m ()
Documentation
Monad transformer of sync core module.
s
- - State of next core module in modules chain;
m
- - Next monad in modules monad stack;
a
- - Type of result value;
How to embed module:
type AppStack = ModuleStack [LoggingT, NetworkT, ActorT, SyncT, ... other modules ... ] IO -- | Current GHC (7.10.3) isn't able to derive this instance SyncMonad AppMonad where getSyncIdM = AppMonad . getSyncIdM getSyncTypeRepM = AppMonad . getSyncTypeRepM registerSyncIdM = AppMonad . registerSyncIdM addSyncTypeRepM a b = AppMonad $ addSyncTypeRepM a b syncScheduleMessageM peer ch i mt msg = AppMonad $ syncScheduleMessageM peer ch i mt msg syncSetLoggingM = AppMonad . syncSetLoggingM syncSetRoleM = AppMonad . syncSetRoleM syncGetRoleM = AppMonad syncGetRoleM syncRequestIdM a b = AppMonad $ syncRequestIdM a b newtype AppMonad a = AppMonad (AppStack a) deriving (Functor, Applicative, Monad, MonadFix, MonadIO, LoggingMonad, MonadThrow, MonadCatch, NetworkMonad, ActorMonad)
The module is NOT pure within first phase (see ModuleStack
docs), therefore currently only IO
end monad can handler the module.
MonadTrans (SyncT s) Source # | |
Monad m => MonadState (SyncState s) (SyncT s m) Source # | |
Monad m => Monad (SyncT s m) Source # | |
Functor m => Functor (SyncT s m) Source # | |
MonadFix m => MonadFix (SyncT s m) Source # | |
Monad m => Applicative (SyncT s m) Source # | |
MonadIO m => MonadIO (SyncT s m) Source # | |
MonadMask m => MonadMask (SyncT s m) Source # | |
MonadThrow m => MonadThrow (SyncT s m) Source # | |
MonadCatch m => MonadCatch (SyncT s m) Source # | |
MonadIO m => SyncMonad (SyncT s m) Source # | |
type ModuleState (SyncT s m) Source # | |
registerSyncIdInternal :: HashableTypeRep -> SyncState s -> (Word64, SyncState s) Source #
Internal implementation of actor registrarion when monadic context isn't in scope
addSyncTypeRepInternal :: HashableTypeRep -> Word64 -> SyncState s -> SyncState s Source #
Internal implementation of actor registrarion when monadic context isn't in scope
syncRequestIdInternal :: forall proxy i m s. (ActorMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i) => Peer -> proxy i -> SyncState s -> m (SyncState s) Source #
Internal implementation of sending service request for actor net id
getServiceChannel :: NetworkMonad m => m ChannelID Source #
Return channel id 1 if network module has more than 1 channel, either fallback to 0
Note: If you open more than one channel, the module would use chanel id 1 as service channel, therefore count of channels on client and server should match (server won't response on channel 1 if it doesn't have it).