-- Describes the current state of the game, -- e.g. Main menu, game, pause, win or lose -- Allows to easily go to a next state and change rendering accordingly module State ( State(..) -- Default state of the game, Menu , defaultState -- Get the next state based on the current state , nextState ) where ----------------------------- Constants ------------------------------ -- Current state of the game. data State = Menu | Playing | Pause | Win | Lose ---------------------------------------------------------------------- defaultState :: State defaultState = Menu nextState :: State -> State nextState Menu = Playing nextState Playing = Pause nextState Pause = Playing nextState _ = Menu