aboutsummaryrefslogtreecommitdiff
path: root/hsm-web/Main.hs
blob: 0eb52372797011a5fcafbf310ff0e8c31e8b48f7 (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
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE TemplateHaskell #-}

import Data.Function ((&))
import Effectful (runEff)
import Effectful.Concurrent (runConcurrent)
import Effectful.Fail (runFailIO)
import Hsm.Core.App (bootstrapAppNoEcho)
import Hsm.I2C (runI2C)
import Hsm.INA226 (runINA226)
import Hsm.Log (Severity (Info), runLogsOpt)
import Hsm.Log.Options (makeLoggerOptionParser)
import Hsm.Stream (runStream)
import Hsm.Web (runServer, runWeb)
-- Import full module for cleaner `-ddump-splices` output
-- Avoids package/module qualifiers in generated code
import Options.Applicative

type Logs = '["gst", "i2c", "ina226", "scotty", "stream", "web"]

$(makeLoggerOptionParser @Logs "Options" "parser" 'Info)

main :: IO ()
main = bootstrapAppNoEcho parser "Launch HsMouse Web Server" $ \opts ->
  runServer
    & runWeb
    & runStream
    & runINA226
    & runI2C
    & runLogsOpt @Options @Logs opts
    & runConcurrent
    & runFailIO
    & runEff