aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-21 20:03:25 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-21 20:03:25 +0530
commit70ac685a5043a7b8ea9b72537dca8258198640c7 (patch)
treeb0e67fd2868cd17354f4b0861caca716d6b9d7ee /src/Chelleport.hs
parent87815edbab70302793fb83259fedc1ae9004d172 (diff)
downloadchelleport-70ac685a5043a7b8ea9b72537dca8258198640c7.tar.gz
chelleport-70ac685a5043a7b8ea9b72537dca8258198640c7.zip
Minor refactor
Diffstat (limited to 'src/Chelleport.hs')
-rw-r--r--src/Chelleport.hs19
1 files changed, 10 insertions, 9 deletions
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