Refactor game state computation
Cleaning up the Tetris module, mainly to favor a MonadState style over explicit `Game -> Game` functions, which were a little awkward. This also led naturally to explicitly isolating `IO`, by having pure state modifiers with types like `Tetris a ~ forall m. StateT Game m a` being executed with `m ~ Identity`, and those few modifiers that need IO specified by `TetrisT a ~ StateT Game IO a`.
This commit is contained in:
parent
09de01695c
commit
ad1fcf9192
6 changed files with 179 additions and 157 deletions
|
@ -7,14 +7,13 @@ import System.Exit (exitSuccess)
|
|||
import System.IO (readFile, writeFile)
|
||||
import Text.Read (readMaybe)
|
||||
|
||||
import Tetris (Game(..))
|
||||
import UI.PickLevel (pickLevel)
|
||||
import UI.Game (playGame)
|
||||
|
||||
import Options.Applicative
|
||||
import qualified System.Directory as D
|
||||
import System.FilePath ((</>))
|
||||
import qualified System.FilePath as F
|
||||
|
||||
import Tetris (Game(..))
|
||||
import UI.PickLevel (pickLevel)
|
||||
import UI.Game (playGame)
|
||||
|
||||
data Opts = Opts
|
||||
{ hardDrop :: Maybe HardDropOpt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue