diff options
author | Jeanne-Kamikaze <jeannekamikaze@gmail.com> | 2013-02-22 17:42:15 +0100 |
---|---|---|
committer | Jeanne-Kamikaze <jeannekamikaze@gmail.com> | 2013-02-22 17:42:15 +0100 |
commit | a3f96d481addd0865164cbb349d62e61971a0007 (patch) | |
tree | cb9d0805afb8518c2470c7ccaf6fa109cee16bb6 | |
parent | 7c0a2694e29a2ef52fcfe3e5de2f3b9c10ce252c (diff) |
Added subGame functions
-rw-r--r-- | Spear/Game.hs | 10 |
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 | |||
75 | runGame' :: Game s a -> s -> IO () | 77 | runGame' :: Game s a -> s -> IO () |
76 | runGame' game state = runGame game state >> return () | 78 | runGame' game state = runGame game state >> return () |
77 | 79 | ||
80 | -- | Run the given game. | ||
81 | runSubGame :: Game s a -> s -> Game t (a,s) | ||
82 | runSubGame game state = lift $ runStateT game state | ||
83 | |||
84 | -- | Run the given game. | ||
85 | runSubGame' :: Game s a -> s -> Game t () | ||
86 | runSubGame' 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. |
79 | evalSubGame :: Game s a -> s -> Game t a | 89 | evalSubGame :: Game s a -> s -> Game t a |
80 | evalSubGame g s = lift $ evalStateT g s | 90 | evalSubGame g s = lift $ evalStateT g s |