Restrict IOE only to effect handlers via inject

This commit is contained in:
James Eversole 2024-10-22 17:44:16 -05:00
parent 415b1dc58e
commit 3f76917c40
2 changed files with 3 additions and 2 deletions

View File

@ -25,7 +25,6 @@ type AppEff =
, Database
, Reader AppEnv
, Error ServerError
, IOE
]
data AppEnv = AppEnv { pool :: Pool Connection }

View File

@ -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