diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-01-14 15:58:56 -0800 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-01-16 18:30:09 -0800 |
commit | 00ad7b9a1c798e611a0c0b7fcbfa5ee76c2f39c4 (patch) | |
tree | f2bcbcd0a8b2a3425b8baec668fccc62a4037ac1 | |
parent | cc639b06c7126fac7b445d8f778455620d7f8f50 (diff) |
Adds minimal documentation
-rw-r--r-- | hsm-command/Main.hs | 2 | ||||
-rw-r--r-- | hsm-core/Hsm/Core/Fsm.hs | 2 | ||||
-rw-r--r-- | hsm-core/Hsm/Core/Log.hs | 2 | ||||
-rw-r--r-- | hsm-dummy-poller/Main.hs | 3 | ||||
-rw-r--r-- | hsm-dummy-pulser/Main.hs | 2 | ||||
-rw-r--r-- | hsm-dummy-receiver/Main.hs | 3 |
6 files changed, 14 insertions, 0 deletions
diff --git a/hsm-command/Main.hs b/hsm-command/Main.hs index 0b24719..efcbc6e 100644 --- a/hsm-command/Main.hs +++ b/hsm-command/Main.hs @@ -21,6 +21,8 @@ data Env = Env $(deriveFromYaml ''Env) +-- Command Service: +-- Reads movement commands from the terminal and publishes them through ZMQ. main :: IO () main = launch @Env "command" id $ \env logger level -> diff --git a/hsm-core/Hsm/Core/Fsm.hs b/hsm-core/Hsm/Core/Fsm.hs index 43fa497..6f9910e 100644 --- a/hsm-core/Hsm/Core/Fsm.hs +++ b/hsm-core/Hsm/Core/Fsm.hs @@ -26,6 +26,8 @@ data FsmOutput i o env sta = data FsmResult i o env sta = FsmResult o sta (FsmState i o env sta) +-- Finite state machines allow processing of stream elements using pure +-- functions. One or more FSMs can be included within a `Streamly` pipeline. fsm :: forall i o env sta es. ( Log :> es diff --git a/hsm-core/Hsm/Core/Log.hs b/hsm-core/Hsm/Core/Log.hs index 9f1f357..9bf8b37 100644 --- a/hsm-core/Hsm/Core/Log.hs +++ b/hsm-core/Hsm/Core/Log.hs @@ -9,6 +9,8 @@ import Data.Time.Clock (getCurrentTime) import Effectful (Eff, (:>)) import Effectful.Log (Log, LogLevel, getLoggerIO, logMessage) +-- Helper function allows logging within IO, Useful during `resourcet` +-- allocation and release operations. withLogIO :: Log :> es => Eff es (LogLevel -> Text -> IO ()) withLogIO = do logIO <- getLoggerIO diff --git a/hsm-dummy-poller/Main.hs b/hsm-dummy-poller/Main.hs index 7a35230..762d139 100644 --- a/hsm-dummy-poller/Main.hs +++ b/hsm-dummy-poller/Main.hs @@ -44,6 +44,9 @@ handle = $ logInfo_ $ "Received pulse #" <> pack (show p) +-- Dummy poller service: +-- Proof of concept. Polls for "pulses" through ZMQ at a set interval and +-- logs each time one is received. main :: IO () main = launch @Env "dummy-poller" withoutInputEcho $ \env logger level -> diff --git a/hsm-dummy-pulser/Main.hs b/hsm-dummy-pulser/Main.hs index 3d734ba..48a5302 100644 --- a/hsm-dummy-pulser/Main.hs +++ b/hsm-dummy-pulser/Main.hs @@ -50,6 +50,8 @@ stateRun = F.FsmState "run" action Nothing [(LogAttention, "Reached " <> pack (show env.pulses) <> " pulses")] +-- Dummy pulser service: +-- Proof of concept. Publishes a "pulse" through ZMQ at a set interval. main :: IO () main = launch @Env "dummy-pulser" withoutInputEcho $ \env logger level -> diff --git a/hsm-dummy-receiver/Main.hs b/hsm-dummy-receiver/Main.hs index c0aa98a..78b343f 100644 --- a/hsm-dummy-receiver/Main.hs +++ b/hsm-dummy-receiver/Main.hs @@ -33,6 +33,9 @@ handle = S.fold S.drain . S.mapM handler handler p = localDomain "receiver" $ logInfo_ $ "Received pulse #" <> pack (show p) +-- Dummy receiver service: +-- Proof of concept. Listens for "pulses" through ZMQ and logs each time one +-- is received. main :: IO () main = launch @Env "dummy-receiver" withoutInputEcho $ \env logger level -> |