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