From cc639b06c7126fac7b445d8f778455620d7f8f50 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Sun, 29 Dec 2024 17:05:34 +0000 Subject: Initial --- hsm-command/Main.hs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 hsm-command/Main.hs (limited to 'hsm-command/Main.hs') diff --git a/hsm-command/Main.hs b/hsm-command/Main.hs new file mode 100644 index 0000000..0b24719 --- /dev/null +++ b/hsm-command/Main.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE OverloadedRecordDot #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} + +import Data.Function ((&)) +import Data.Text (Text) +import Effectful (runEff) +import Effectful.Log (runLog) +import Effectful.Reader.Static (runReader) +import Effectful.Resource (runResource) +import Hsm.Command.Command (commandStream) +import Hsm.Command.Readline (runReadline) +import Hsm.Core.App (launch) +import Hsm.Core.Env (deriveFromYaml) +import Hsm.Core.Zmq.Server (runServer, send) + +data Env = Env + { name :: Text + , pubEp :: Text + } + +$(deriveFromYaml ''Env) + +main :: IO () +main = + launch @Env "command" id $ \env logger level -> + (commandStream & send @Env) + & runServer @Env + & runLog env.name logger level + & runReader env + & runReadline + & runResource + & runEff -- cgit v1.2.1