aboutsummaryrefslogtreecommitdiff
path: root/hsm-web/Main.hs
blob: 0ec780e69f9bcce019e445e566674c906cc67df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE TemplateHaskell #-}

import Data.Function ((&))
import Effectful (runEff)
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.Web (runServer, runWeb)
-- Import full module for cleaner `-ddump-splices` output
-- Avoids package/module qualifiers in generated code
import Options.Applicative

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

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

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