blob: efcbc6e31010818d9839a883fe4546404d2854b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{-# 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)
-- Command Service:
-- Reads movement commands from the terminal and publishes them through ZMQ.
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
|