[Haskell-beginners] heterogeneous containers and static typing

Franco franco00 at gmx.com
Thu Nov 7 16:02:38 UTC 2013


Ryan Trinkle <ryan.trinkle <at> gmail.com> writes:

> 
> 
> Hi Franco,
> Have you considered allowing the user of your game engine to supply his or
her own type for the game state?  You could combine this with any state that
the engine itself needs, like so:
> 
> data GameState a = GameState EngineState a
> 
> Then, your user could make use of 'GameState MyGameState' to hold both his
or her own game's state as well as the engine's state.
> 
> 

A very elegant and simple solution, thank you!






More information about the Beginners mailing list