diff options
Diffstat (limited to 'hsm-command/Main.hs')
-rw-r--r-- | hsm-command/Main.hs | 33 |
1 files changed, 33 insertions, 0 deletions
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 |