fumieval / free-game

The free game engine
http://hackage.haskell.org/package/free-game
BSD 3-Clause "New" or "Revised" License
64 stars 15 forks source link

Add loop support function "controlledGame" #43

Closed EPashkin closed 9 years ago

EPashkin commented 9 years ago

New stateful loop function. Not sure about its name and "main" type (Game or Frame).

EPashkin commented 9 years ago

Seems "main" type only options is Game. With Frame I get an error that I do not understand demo_stateful2.hs:25:5: No instance for (Monad FreeGame.UI.UI) arising from a use of `tick' In a stmt of a 'do' block: tick

EPashkin commented 9 years ago

After thinking, I realized that this attempt is bad. I better to try a variant with "StateT a Game ()" or better "MonadTrans t => t a Game()" and with some Maybe for stopping execution. And splitting processing into computation and drawing in the library are unnecessary.

fumieval commented 9 years ago

Your controlledGame is general enough not to include in this package.

EPashkin commented 9 years ago

Unfortunately, my English is not enough to understand your answer. Can you split it into two sentences?

fumieval commented 9 years ago

controlledGame doesn't depend on anything in free-game. Instead, you can make a separate package that provides such combinators.

Perhaps the monad-loops package is what you want.

EPashkin commented 9 years ago

Understand now, tnx.