Add a simple logging effect and adapt only at IO sites

This commit is contained in:
James Eversole
2024-10-12 17:38:22 -05:00
parent 6e2fb3b9bd
commit 9a8bd089e5
4 changed files with 76 additions and 36 deletions

View File

@@ -13,6 +13,9 @@ import Network.Wai.Handler.Warp (run)
import Servant hiding ((:>), throwError)
import qualified Servant as S
--
-- Application
--
main :: IO ()
main = run port $ serve proxy app
@@ -23,8 +26,14 @@ app = α $ rootHandler
:<|> userPostHandler
α :: ServerT API AppEff -> ServerT API Handler
α = hoistServer proxy $ Handler . ExceptT .
runEff . runErrorNoCallStack . runFileSystem . runDatabaseIO
α = hoistServer proxy
$ Handler
. ExceptT
. runEff
. runErrorNoCallStack
. runLoggerIO
. runFileSystem
. runDatabaseIO
port :: Int
port = 8080