aboutsummaryrefslogtreecommitdiff
path: root/hsm-dummy-receiver/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-dummy-receiver/Main.hs')
-rw-r--r--hsm-dummy-receiver/Main.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/hsm-dummy-receiver/Main.hs b/hsm-dummy-receiver/Main.hs
index 451e9c4..6f3db81 100644
--- a/hsm-dummy-receiver/Main.hs
+++ b/hsm-dummy-receiver/Main.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
+import Data.ByteString (ByteString)
import Data.Function ((&))
import Data.Text (Text, pack)
import Effectful (Eff, (:>), runEff)
@@ -10,6 +11,7 @@ import Effectful.Reader.Static (runReader)
import Effectful.Resource (runResource)
import Hsm.Core.App (launch)
import Hsm.Core.Env (deriveFromYaml)
+import Hsm.Core.Message (body)
import Hsm.Core.Zmq.Client (receive, runClient)
import Streamly.Data.Fold qualified as S (drain)
import Streamly.Data.Stream qualified as S (Stream, fold, mapM)
@@ -23,7 +25,7 @@ data Env = Env
$(deriveFromYaml ''Env)
-handle :: Log :> es => S.Stream (Eff es) Int -> Eff es ()
+handle :: Log :> es => S.Stream (Eff es) ByteString -> Eff es ()
handle = S.fold S.drain . S.mapM handler
where
handler =
@@ -32,6 +34,7 @@ handle = S.fold S.drain . S.mapM handler
. mappend "Received pulse #"
. pack
. show
+ . body @Int
-- Dummy receiver service:
-- Proof of concept. Listens for "pulses" through ZMQ and logs each time one