Contains the command type and related utilities.
Represents an IO-like monad with knowledge about the state of the game engine. Each command contains a collection of game actions that will be applied to your game's update function to update the game state. This is similar to a subscription in a way, with the difference being that a command does not change over time, but rather is a lazy monad and hence contains a value that from the time of the execution. A good example of the usage of a command vs. a subscription is the game window size - a command would allow you to map the current window size into an action, whereas a subscription would let you subscribe to when the window is resized and then map that event into a game action.
Just like a subscription, any function that returns a command in the Helm library will first let you map from the original contained value to a game action. It's important to note that commands are **evaluated on the main-thread** - which means they can block the rendering process. *Don't execute long-running monads under commands!*
Here the type variable e is an instance of the
and the variable a is the game action data type used by your game.
Combine a list of commands into a single one.
A command that does nothing. When returned in a Helm game's update or initial functions, it will not produce any game actions.
|:: Engine e|
|=> IO b|
The IO monad to execute.
|-> (b -> a)|
The function to map the monad result to an action.
|-> Cmd e a|
The mapped command.
Execute an IO monad and then map its result to a game action.
This can be used as a kind of
liftIO, however to keep
things consistent with the rest of the library, you
must map the monad result a game action.