aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeanne-Kamikaze <jeannekamikaze@gmail.com>2013-02-22 17:42:15 +0100
committerJeanne-Kamikaze <jeannekamikaze@gmail.com>2013-02-22 17:42:15 +0100
commita3f96d481addd0865164cbb349d62e61971a0007 (patch)
treecb9d0805afb8518c2470c7ccaf6fa109cee16bb6
parent7c0a2694e29a2ef52fcfe3e5de2f3b9c10ce252c (diff)
Added subGame functions
-rw-r--r--Spear/Game.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Spear/Game.hs b/Spear/Game.hs
index 6bb1fa6..cf33ccb 100644
--- a/Spear/Game.hs
+++ b/Spear/Game.hs
@@ -15,6 +15,8 @@ module Spear.Game
15 -- * Running and IO 15 -- * Running and IO
16, runGame 16, runGame
17, runGame' 17, runGame'
18, runSubGame
19, runSubGame'
18, evalSubGame 20, evalSubGame
19, execSubGame 21, execSubGame
20, gameIO 22, gameIO
@@ -75,6 +77,14 @@ runGame game state = runErrorT . R.runResourceT . runStateT game $ state
75runGame' :: Game s a -> s -> IO () 77runGame' :: Game s a -> s -> IO ()
76runGame' game state = runGame game state >> return () 78runGame' game state = runGame game state >> return ()
77 79
80-- | Run the given game.
81runSubGame :: Game s a -> s -> Game t (a,s)
82runSubGame game state = lift $ runStateT game state
83
84-- | Run the given game.
85runSubGame' :: Game s a -> s -> Game t ()
86runSubGame' game state = runSubGame game state >> return ()
87
78-- | Run the given game and return its result. 88-- | Run the given game and return its result.
79evalSubGame :: Game s a -> s -> Game t a 89evalSubGame :: Game s a -> s -> Game t a
80evalSubGame g s = lift $ evalStateT g s 90evalSubGame g s = lift $ evalStateT g s