From ba128de9313cb0fe4dc2a8e4d6054a4b93341f2b Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 2 Jan 2025 10:00:35 -0800 Subject: Rename runSubGame -> runChildGame. --- Spear/App.hs | 2 +- Spear/Game.hs | 10 +++++----- Spear/Scene/Loader.hs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Spear/App.hs b/Spear/App.hs index 6e8f5f2..e85c46b 100644 --- a/Spear/App.hs +++ b/Spear/App.hs @@ -163,7 +163,7 @@ runApp app = , appCustomState = gameState } -- Run app. - (result, endAppState) <- runSubGame appState $ do + (result, endAppState) <- runChildGame appState $ do loop app window endApp app -- Shut down. diff --git a/Spear/Game.hs b/Spear/Game.hs index 0c8b963..ae986c8 100644 --- a/Spear/Game.hs +++ b/Spear/Game.hs @@ -22,7 +22,7 @@ module Spear.Game , catch -- * Running and IO , runGame -, runSubGame +, runChildGame , runSiblingGame , eval , exec @@ -106,18 +106,18 @@ assertMaybe (Just x) _ = return x runGame :: s -> Game s a -> IO (a, s) runGame state game = runResourceT . runStateT (getGame game) $ state --- | Run the given sub-game, unrolling the full monad stack and returning the +-- | Run the given child game, unrolling the full monad stack and returning the -- game's result and its final state. -- -- Like `runGame`, this frees any resources that are acquired by the sub-game. -- If you want to keep acquired resources, see `runSiblingGame` instead. -runSubGame :: s -> Game s a -> Game t (a, s) -runSubGame state game = liftIO $ runGame state game +runChildGame :: s -> Game s a -> Game t (a, s) +runChildGame state game = liftIO $ runGame state game -- | Run the given sibling game, unrolling the state transformer but not the -- resource transformer. -- --- Unlike `runSubGame`, any resources acquired by the sibling game are *not* +-- Unlike `runChildGame`, any resources acquired by the sibling game are *not* -- released. runSiblingGame :: s -> Game s a -> Game t (a, s) runSiblingGame state game = Game . lift $ runStateT (getGame game) state diff --git a/Spear/Scene/Loader.hs b/Spear/Scene/Loader.hs index 5f96f8c..0593c77 100644 --- a/Spear/Scene/Loader.hs +++ b/Spear/Scene/Loader.hs @@ -58,7 +58,7 @@ validate _ = Nothing -- | Load the scene described by the given 'SceneGraph'. resourceMap :: SceneGraph -> Game s SceneResources -resourceMap g = exec runSubGame emptySceneResources (resourceMap' g) +resourceMap g = exec runChildGame emptySceneResources (resourceMap' g) resourceMap' :: SceneGraph -> Loader () resourceMap' node@(SceneLeaf nid props) = do -- cgit v1.2.3