adding missing files
This commit is contained in:
parent
5defc8e74a
commit
da2ba52aae
4 changed files with 33 additions and 0 deletions
18
src/Affection/MessageBus/Class.hs
Normal file
18
src/Affection/MessageBus/Class.hs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
module Affection.MessageBus.Class where
|
||||||
|
|
||||||
|
import Control.Concurrent.STM as STM
|
||||||
|
|
||||||
|
import Data.IORef
|
||||||
|
|
||||||
|
import Affection.MessageBus.Message
|
||||||
|
|
||||||
|
type Channel msg = TChan msg
|
||||||
|
|
||||||
|
class Participant prt where
|
||||||
|
partChannel :: (Message msg) => prt -> IORef (Channel msg)
|
||||||
|
|
||||||
|
partConnectChannel :: (Message msg) => prt -> Channel msg -> IO ()
|
||||||
|
|
||||||
|
partListen :: (Message msg) => prt -> IO msg
|
||||||
|
|
||||||
|
partBroadcast :: (Message msg) => prt -> msg -> IO ()
|
3
src/Affection/MessageBus/Engine.hs
Normal file
3
src/Affection/MessageBus/Engine.hs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module Affection.MessageBus.Engine where
|
||||||
|
|
||||||
|
import Affection.MessageBus.Class
|
4
src/Affection/MessageBus/Message.hs
Normal file
4
src/Affection/MessageBus/Message.hs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module Affection.MessageBus.Message where
|
||||||
|
|
||||||
|
class Message msg where
|
||||||
|
msgPayload :: msg -> a
|
8
src/Affection/MessageBus/Util.hs
Normal file
8
src/Affection/MessageBus/Util.hs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
module Affection.MessageBus.Util where
|
||||||
|
|
||||||
|
import Affection.MessageBus.Class
|
||||||
|
import Affection.MessageBus.Message
|
||||||
|
import Control.Concurrent.STM as STM
|
||||||
|
|
||||||
|
newBroadcastChannel :: (Message msg) => IO (Channel msg)
|
||||||
|
newBroadcastChannel = atomically $ newBroadcastTChan
|
Loading…
Reference in a new issue