diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-02-22 16:50:42 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-02-22 16:50:42 +0100 |
commit | 62fe58cb55a279c285980a313d4355d91e93601c (patch) | |
tree | 7e318f4b62c7f90b0fad5e267ec9c3194fae53c7 /Game.hs | |
download | htanks-62fe58cb55a279c285980a313d4355d91e93601c.tar htanks-62fe58cb55a279c285980a313d4355d91e93601c.zip |
Initial commit
Diffstat (limited to 'Game.hs')
-rw-r--r-- | Game.hs | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 |