In a game of Connect4:
- we start with an empty grid
- two players place pieces x and o on the grid
- the first player to achieve 4 pieces in a line wins!
- this is a text based console game
My thinking is that:
- at each step of the game the Grid is transitioning from one state to another
- hence i need to use the State monad
- and because this is a console based app that involves io
- in this case I also need to use the IO monad
Is this thinking correct?
Assuming the above is correct, which one of these is correct?
- type StateInIO[S,A] = IO[State[S,A]]
- type IOInState[S,A] = State[S,IO[A]]
I favour the second option, makes more sense to me.
Can I stack these monads (State, IO) in this way?