moar documentation
This commit is contained in:
parent
f44021f034
commit
aa7be84883
1 changed files with 24 additions and 6 deletions
|
@ -1,15 +1,33 @@
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
|
||||||
module Affection.MessageBus.Class where
|
module Affection.MessageBus.Class where
|
||||||
|
|
||||||
import Affection.MessageBus.Message
|
import Affection.MessageBus.Message
|
||||||
import Affection.Types
|
import Affection.Types
|
||||||
|
|
||||||
class Participant prt m where
|
class (Message m) => Participant prt m where
|
||||||
partChannel :: prt -> Channel m
|
-- | get the outbound 'Channel' of the 'Participant'
|
||||||
|
partChannel
|
||||||
|
:: prt -- ^ The 'Participant'
|
||||||
|
-> Channel m -- ^ Outbound 'Channel'
|
||||||
|
|
||||||
partInit :: Affection sd m prt
|
-- | Initialize the 'Participant' with an inbound 'Channel'
|
||||||
|
partInit
|
||||||
|
:: Channel m -- ^ Inbound 'Channel' the 'Participant' will listen to
|
||||||
|
-> Affection sd prt -- ^ The constructed and initialized 'Participant'
|
||||||
|
|
||||||
partListen :: prt -> IO (Maybe m)
|
-- Get the 'Participant' to listen to its inbound 'Channel'
|
||||||
|
partListen
|
||||||
|
:: prt -- ^ The 'Participant'
|
||||||
|
-> Affection sd (Maybe m) -- ^ The optional 'Message' peeked from the 'Channel'
|
||||||
|
|
||||||
partEmit :: prt -> m -> IO ()
|
-- Get the 'Participant' to emit a Message on its outbound 'Channel'
|
||||||
|
partEmit
|
||||||
|
:: prt -- ^ The 'Participant'
|
||||||
|
-> m -- ^ The 'Message' to emit
|
||||||
|
-> Affection sd ()
|
||||||
|
|
||||||
|
-- data Envelope = Envelope
|
||||||
|
-- { envFrom :: (Participant a _) => a
|
||||||
|
-- , envTo :: (Participant b _) => b
|
||||||
|
-- , envMessage :: (Message msg) => msg
|
||||||
|
-- }
|
||||||
|
|
Loading…
Reference in a new issue