aboutsummaryrefslogtreecommitdiff
path: root/hsm-core/Hsm/Core/Zmq/Server.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-core/Hsm/Core/Zmq/Server.hs')
-rw-r--r--hsm-core/Hsm/Core/Zmq/Server.hs25
1 files changed, 9 insertions, 16 deletions
diff --git a/hsm-core/Hsm/Core/Zmq/Server.hs b/hsm-core/Hsm/Core/Zmq/Server.hs
index 5663cd8..2e9217b 100644
--- a/hsm-core/Hsm/Core/Zmq/Server.hs
+++ b/hsm-core/Hsm/Core/Zmq/Server.hs
@@ -47,7 +47,6 @@ send ::
-> Eff es ()
send = S.fold S.drain . S.mapM sender
where
- sender :: a -> Eff es ()
sender payload = do
Server sock <- E.getStaticRep
env <- ask @env
@@ -64,18 +63,12 @@ runServer ::
)
=> Eff (Server : es) a
-> Eff es a
-runServer action = withSocket Z.Pub >>= run
- where
- run :: Z.Socket Z.Pub -> Eff es a
- run sock = E.evalStaticRep (Server sock) $ initialize >> action
- where
- bind :: Text -> Eff (Server : es) ()
- bind = E.unsafeEff_ . Z.bind sock . unpack
- --
- initialize :: Eff (Server : es) ()
- initialize =
- localDomain domain $ do
- logInfo_ "Initializing ZMQ server"
- env <- ask @env
- bind env.pubEp
- logTrace_ $ "Publishing to " <> env.pubEp
+runServer action =
+ withSocket Z.Pub >>= \sock ->
+ E.evalStaticRep (Server sock) $ do
+ localDomain domain $ do
+ logInfo_ "Initializing ZMQ server"
+ env <- ask @env
+ E.unsafeEff_ $ Z.bind sock $ unpack env.pubEp
+ logTrace_ $ "Publishing to " <> env.pubEp
+ action