Quantcast

State, StateT, or ST for game settings?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

State, StateT, or ST for game settings?

Dave Martin
I would like to create a game with a "main menu" offering the user a choice of "playing the game" or accessing a "settings menu," in which he can change defaults that would affect the game play (e.g. board size, etc.).

I know (barely) enough about the "IO monad" to write the menus and the basic gameplay, but what device do I need in order to manage the settings? A State monad? A StateT monad transformer? An ST monad? None of the above? I have some basic familiarity with the first two, but not enough to really grasp how they are actually used.

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: State, StateT, or ST for game settings?

Francesco Ariis
On Sat, Mar 18, 2017 at 08:42:38PM -0400, Dave Martin wrote:
> I would like to create a game with a "main menu" offering the user a choice of "playing the game" or accessing a "settings menu," in which he can change defaults that would affect the game play (e.g. board size, etc.).
>
> I know (barely) enough about the "IO monad" to write the menus and the basic gameplay, but what device do I need in order to manage the settings? A State monad? A StateT monad transformer? An ST monad? None of the above? I have some basic familiarity with the first two, but not enough to really grasp how they are actually used.

Hello Dave,
    State will do! Of course if you need to mix the two monads (State +
IO) you need a State transformer (StateT)
-F
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Loading...