Restrict IOE only to effect handlers via inject
This commit is contained in:
parent
415b1dc58e
commit
3f76917c40
@ -25,7 +25,6 @@ type AppEff =
|
||||
, Database
|
||||
, Reader AppEnv
|
||||
, Error ServerError
|
||||
, IOE
|
||||
]
|
||||
|
||||
data AppEnv = AppEnv { pool :: Pool Connection }
|
||||
|
@ -13,7 +13,7 @@ import Effectful.Error.Static (Error, runErrorNoCallStack, throwError)
|
||||
import Effectful.Reader.Static
|
||||
import Network.Wai.Handler.Warp (run)
|
||||
import Network.Wai.Middleware.Static ((>->), staticPolicy, noDots, addBase)
|
||||
import Servant hiding ((:>), throwError)
|
||||
import Servant hiding ((:>), throwError, inject)
|
||||
import qualified Servant as S
|
||||
|
||||
--
|
||||
@ -45,6 +45,7 @@ runAppEff env = runEff
|
||||
. runReader env
|
||||
. runDatabaseIO
|
||||
. runLoggerPSQL
|
||||
. inject
|
||||
|
||||
runAppDebug :: AppEnv -> AppEff a -> IO (Either ServerError a)
|
||||
runAppDebug env = runEff
|
||||
@ -52,6 +53,7 @@ runAppDebug env = runEff
|
||||
. runReader env
|
||||
. runDatabaseDebug
|
||||
. runLoggerConsole
|
||||
. inject
|
||||
|
||||
port :: Int
|
||||
port = 8080
|
||||
|
Loading…
x
Reference in New Issue
Block a user