diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-01-17 14:37:20 -0800 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-01-17 19:16:43 -0800 |
commit | ebb88408c1d0884b5ca9b7d68bf76d31c33d2e5b (patch) | |
tree | c7c2c6b636e8eb89f2d4c6accf77a8c671b8ab9f /hsm-dummy-receiver/Main.hs | |
parent | dc6bf1472c930ff1448c419d3205148bce1b787e (diff) |
Diffstat (limited to 'hsm-dummy-receiver/Main.hs')
-rw-r--r-- | hsm-dummy-receiver/Main.hs | 5 |
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 |