module Main (main) where import Core import Database import Handlers import Control.Monad.Except (ExceptT (ExceptT)) import Data.List import Effectful import Effectful.Error.Static (Error, runError, runErrorNoCallStack, throwError) import Effectful.FileSystem import Network.Wai.Handler.Warp (run) import Servant hiding ((:>), throwError) import qualified Servant as S -- -- Application -- main :: IO () main = run port $ serve proxy app app :: Server API app = α $ rootHandler :<|> userListHandler :<|> userGetHandler :<|> userPostHandler α :: ServerT API AppEff -> ServerT API Handler α = hoistServer proxy $ Handler . ExceptT . runEff . runErrorNoCallStack . runLoggerIO . runFileSystem . runDatabaseIO port :: Int port = 8080 proxy :: Proxy API proxy = Proxy