dunai-0.13.1: Generalised reactive framework supporting classic, arrowized and monadic FRP.
Copyright(c) Ivan Perez and Manuel Baerenz 2016
LicenseBSD3
Maintainerivan.perez@keera.co.uk
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Trans.MSF.List

Description

MSFs with a list monadic layer.

This module contains functions to work with MSFs that include a ListT monadic layer. MSFs on a list monad may produce multiple outputs and continuations, or none. This enables the possibility for spawning new MSFs, or stopping MSFs, at will.

A common use case is to be able to dynamically spawn new interactive elements in applications (e.g., a game object that splits in two, or that fires to an enemy).

WARNING: the ListT transformer is considered dangerous, and imposes additional constraints on the inner monad in order for the combination of the monad and the transformer to be a monad. Use at your own risk.

Synopsis

Documentation

widthFirst :: (Functor m, Monad m) => MSF (ListT m) a b -> MSF m a [b] Source #

Run an MSF in the ListT transformer (i.e., multiple MSFs producing each producing one output), by applying the input stream to each MSF in the list transformer and concatenating the outputs of the MSFs together.

An MSF in the ListT transformer can spawn into more than one MSF, or none, so the outputs produced at each individual step are not guaranteed to all have the same length.

sequenceS :: Monad m => [MSF m a b] -> MSF (ListT m) a b Source #

Build an MSF in the ListT transformer by broadcasting the input stream value to each MSF in a given list.

mapMSF :: Monad m => MSF m a b -> MSF m [a] [b] Source #

Apply an MSF to every input.