Add a simple logging effect and adapt only at IO sites
This commit is contained in:
13
src/Main.hs
13
src/Main.hs
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user