diff options
Diffstat (limited to 'hsm-core/Hsm/Core/Zmq.hs')
-rw-r--r-- | hsm-core/Hsm/Core/Zmq.hs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/hsm-core/Hsm/Core/Zmq.hs b/hsm-core/Hsm/Core/Zmq.hs deleted file mode 100644 index 2f70d48..0000000 --- a/hsm-core/Hsm/Core/Zmq.hs +++ /dev/null @@ -1,29 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module Hsm.Core.Zmq - ( withSocket - ) where - -import Effectful (Eff, IOE, (:>)) -import Effectful.Log (Log, LogLevel(LogTrace)) -import Effectful.Resource (Resource, allocate) -import Hsm.Core.Log (withLogIO) -import System.ZMQ4 qualified as Z - -withSocket :: - (Z.SocketType t, IOE :> es, Log :> es, Resource :> es) - => t - -> Eff es (Z.Socket t) -withSocket stype = withLogIO >>= bracket - where - bracket logIO = snd . snd <$> allocate acquire release - where - acquire = - logIO LogTrace "Acquiring ZMQ context" >> do - cont <- Z.context - sock <- Z.socket cont stype - return (cont, sock) - release (cont, sock) = - logIO LogTrace "Releasing ZMQ context" >> do - Z.close sock - Z.shutdown cont |