From 70ac685a5043a7b8ea9b72537dca8258198640c7 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 21 Dec 2024 20:03:25 +0530 Subject: Minor refactor --- src/Chelleport.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/Chelleport.hs') diff --git a/src/Chelleport.hs b/src/Chelleport.hs index 95e8af9..df3433e 100644 --- a/src/Chelleport.hs +++ b/src/Chelleport.hs @@ -22,18 +22,19 @@ import Control.Monad.Reader (ReaderT (runReaderT)) import Data.Maybe (fromMaybe, isJust) import qualified SDL -runEff :: (MonadIO m) => DrawContext -> AppM m x -> m x -runEff ctx action = runReaderT (runAppM action) ctx - run :: IO () run = do ctx <- initializeContext - setupAppShell - ctx - (runEff ctx initialState) - (\state -> runEff ctx . update state) - (const eventHandler) - (runEff ctx . Chelleport.View.render) + runAppWithCtx ctx $ + setupAppShell + ctx + initialState + update + (const eventHandler) + Chelleport.View.render + where + runAppWithCtx :: (MonadIO m) => DrawContext -> AppM m x -> m x + runAppWithCtx ctx action = runReaderT (runAppM action) ctx initialState :: (Monad m) => m State initialState = do -- cgit v1.3.1