[Haskell-cafe] 'Proper' use of the State monad
isaacdupree at charter.net
Mon Apr 30 17:27:51 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Denis Volk wrote:
> There are difficulties with the first option, including keeping even
> more state about what we're doing (for instance, are we in a menu?),
> and adding stuff later would possibly require substantial rewrites.
> Other than the fact that I would have IO in places where it perhaps
> shouldn't be, the second option seems better, but I am new to all this
> and it may be that I'm missing something.
Are you going to be making lots of separate little sequenced changes to
the state? If not, passing it around explicitly may be clearer. It may
be helpful to distinguish between logical game state and the
user-interface parts (such as "in a menu"), possibly putting them in
different 'data', different parts of the code.
Hoping that was any help,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the Haskell-Cafe