summaryrefslogtreecommitdiffstats
path: root/Game.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Game.hs')
-rw-r--r--Game.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/Game.hs b/Game.hs
new file mode 100644
index 0000000..ef760d7
--- /dev/null
+++ b/Game.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+module Game ( GameState(..)
+ , Game
+ , runGame
+ ) where
+
+import Level
+import Tank
+
+import Control.Monad
+import Control.Monad.State
+
+
+data GameState = GameState
+ { level :: !Level
+ , tanks :: ![Tank]
+ } deriving (Show)
+
+
+newtype Game a = Game (StateT GameState IO a)
+ deriving (Monad, MonadIO, MonadState GameState)
+
+runGame :: GameState -> Game a -> IO (a, GameState)
+runGame st (Game a) = runStateT a st