From 3f76917c4076a958bedb89286a3909a77d579246 Mon Sep 17 00:00:00 2001 From: James Eversole Date: Tue, 22 Oct 2024 17:44:16 -0500 Subject: [PATCH] Restrict IOE only to effect handlers via inject --- src/Core.hs | 1 - src/Main.hs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Core.hs b/src/Core.hs index b38873a..82392ae 100644 --- a/src/Core.hs +++ b/src/Core.hs @@ -25,7 +25,6 @@ type AppEff = , Database , Reader AppEnv , Error ServerError - , IOE ] data AppEnv = AppEnv { pool :: Pool Connection } diff --git a/src/Main.hs b/src/Main.hs index 67462c8..6b91241 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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