Safe Haskell | None |
---|---|
Language | Haskell2010 |
Build a Control.Eff.Concurrent.EffectfulServer from callbacks.
This module contains in instance of Server
that delegates to
callback functions.
Since: 0.27.0
Synopsis
- start :: forall tag eLoop q h. (HasCallStack, TangibleCallbacks tag eLoop q, Server (Server tag eLoop) (Processes q), LogsTo h (Processes q)) => (forall x. Endpoint tag -> Eff eLoop x -> Eff (Processes q) x) -> (Endpoint tag -> Event tag -> Eff eLoop ()) -> ServerId tag -> Eff (Processes q) (Endpoint tag)
- startLink :: forall tag eLoop q h. (HasCallStack, TangibleCallbacks tag eLoop q, Server (Server tag eLoop) (Processes q), LogsTo h (Processes q)) => (forall x. Endpoint tag -> Eff eLoop x -> Eff (Processes q) x) -> (Endpoint tag -> Event tag -> Eff eLoop ()) -> ServerId tag -> Eff (Processes q) (Endpoint tag)
- data Server tag eLoop
- newtype ServerId (tag :: Type) = MkServerId {}
- data Event a where
- OnCall :: forall a r. (Tangible r, TangiblePdu a (Synchronous r)) => ReplyTarget a r -> Pdu a (Synchronous r) -> Event a
- OnCast :: forall a. TangiblePdu a Asynchronous => Pdu a Asynchronous -> Event a
- OnInterrupt :: Interrupt Recoverable -> Event a
- OnDown :: ProcessDown -> Event a
- OnTimeOut :: TimerElapsed -> Event a
- OnMessage :: StrictDynamic -> Event a
- type TangibleCallbacks tag eLoop e = (LogIo e, HasProcesses eLoop e, Typeable e, Typeable eLoop, Typeable tag)
Documentation
start :: forall tag eLoop q h. (HasCallStack, TangibleCallbacks tag eLoop q, Server (Server tag eLoop) (Processes q), LogsTo h (Processes q)) => (forall x. Endpoint tag -> Eff eLoop x -> Eff (Processes q) x) -> (Endpoint tag -> Event tag -> Eff eLoop ()) -> ServerId tag -> Eff (Processes q) (Endpoint tag) Source #
Execute the server loop.
Since: 0.27.0
startLink :: forall tag eLoop q h. (HasCallStack, TangibleCallbacks tag eLoop q, Server (Server tag eLoop) (Processes q), LogsTo h (Processes q)) => (forall x. Endpoint tag -> Eff eLoop x -> Eff (Processes q) x) -> (Endpoint tag -> Event tag -> Eff eLoop ()) -> ServerId tag -> Eff (Processes q) (Endpoint tag) Source #
Execute the server loop.
Since: 0.27.0
data Server tag eLoop Source #
Phantom type to indicate a callback based Server
instance.
Since: 0.27.0
Instances
newtype ServerId (tag :: Type) Source #
The name/id of a Server
for logging purposes.
Since: 0.24.0
Instances
Eq (ServerId tag) Source # | |
Ord (ServerId tag) Source # | |
Typeable tag => Show (ServerId tag) Source # | |
IsString (ServerId tag) Source # | |
Defined in Control.Eff.Concurrent.Protocol.CallbackServer fromString :: String -> ServerId tag # | |
NFData (ServerId tag) Source # | |
This event sum-type is used to communicate incoming messages and other events to the
instances of Server
.
Since: 0.24.0
OnCall :: forall a r. (Tangible r, TangiblePdu a (Synchronous r)) => ReplyTarget a r -> Pdu a (Synchronous r) -> Event a | A Since: 0.24.1 |
OnCast :: forall a. TangiblePdu a Asynchronous => Pdu a Asynchronous -> Event a | |
OnInterrupt :: Interrupt Recoverable -> Event a | |
OnDown :: ProcessDown -> Event a | |
OnTimeOut :: TimerElapsed -> Event a | |
OnMessage :: StrictDynamic -> Event a |
type TangibleCallbacks tag eLoop e = (LogIo e, HasProcesses eLoop e, Typeable e, Typeable eLoop, Typeable tag) Source #
The constraints for a tangible Server
instance.
Since: 0.27.0