module Lib ( main ) where import qualified Core.Configuration as Configuration import qualified Core.HTTP as HTTP import qualified Core.Mongo as DB import Core.Types import Control.Monad.Reader (liftIO, runReaderT) import Database.MongoDB (MongoContext) import GHC.Natural (popCountNatural) import Prelude hiding (id) import Web.Scotty.Trans (scottyT) main :: IO () main = do dhallConf <- liftIO Configuration.main dataDB <- liftIO $ DB.mongoSetup dhallConf let config = AppConfig { res = dhallConf , dbconn = dataDB } scottyT (port dhallConf) (flip runApp config) HTTP.app where runApp :: ConfigM a -> AppConfig -> IO a runApp m = runReaderT (runConfigM m)