helm-1.0.0: A functionally reactive game engine.

Safe HaskellNone
LanguageHaskell2010

Helm.Sub

Contents

Description

Contains the subscription type and related utilities.

Synopsis

Types

newtype Sub e a Source

Represents a subscription to a stream of events captured from a user's interaction with the engine. A subscription is best thought of as a collection of events over time - which is the nature of functional reactive programming (the paradigm that Helm bases it's concepts on). Although Helm uses a departed version of the traditional FRP paradigm, it still follows the concept closely and hence an understanding of FRP will allow you to understnad the library easily.

Functions throughout the Helm library that return a subscription will first let you map the data related to the event you're subscribing to into another form (specifically, a game action). These game actions are then sent to the update function of your game, i.e. the mapped subscription specifies exactly how game events will interact with your game state.

Here the type variable e is an instance of the Engine typeclass and the variable a is the game action data type used by your game.

Constructors

Sub (SignalGen e (Signal [a])) 

Utilities

batch Source

Arguments

:: Engine e 
=> [Sub e a]

The list of subscriptions.

-> Sub e a

The subscriptions accumulated.

Combine a list of subscriptions into a single one. This is allows for subscriptions to multiple input events to be combined into one subscription that encompasses all the actions mapped from events.

none :: Engine e => Sub e a Source

A subscription that does nothing. If user input events aren't required for a game, return this in the subscriptions function of the game.