moar documentation

This commit is contained in:
nek0 2017-12-12 13:12:27 +01:00
parent f44021f034
commit aa7be84883

View file

@ -1,15 +1,33 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
module Affection.MessageBus.Class where
import Affection.MessageBus.Message
import Affection.Types
class Participant prt m where
partChannel :: prt -> Channel m
class (Message m) => Participant prt m where
-- | 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
-- }