midair-0.2.0.1: Hot-swappable FRP

Safe HaskellSafe
LanguageHaskell2010

Midair.Handy

Contents

Synopsis

Representations of IO Action Outputs

data Fx a where Source #

Representation of side-effecting actions. Usually the final result of the FRP graph

Constructors

Fx_Void :: IO () -> Fx a 
Fx_Return :: IO a -> Fx a 

runFx :: Fx a -> IO (Maybe a) Source #

sPrint :: Show a => SFlow a (Fx b) Source #

Handy for developing

Handy Signal Flow Nodes

Numbers

sMax :: Ord x => SFlow x x Source #

Max of all values

sMaxHS :: Ord x => Maybe x -> SFlow x x Source #

Hotswap version of sMax

sMin :: Ord x => SFlow x x Source #

Min of all values

sMinHS :: Ord x => Maybe x -> SFlow x x Source #

Hotswap version of sMin

sSum :: Num n => SFlow n n Source #

Add all values from the input stream

sSumHS :: Num n => Maybe n -> SFlow n n Source #

Hotswap version of sSum

sProduct :: Num n => SFlow n n Source #

Multiply all values from the input stream

sProductHS :: Num n => Maybe n -> SFlow n n Source #

Hotswap version of sProduct

Booleans and Predicates

sAnd :: SFlow Bool Bool Source #

Return True if all input signal values have been True, otherwise False

sOr :: SFlow Bool Bool Source #

Return True if any input signal values have been true

sAny :: (a -> Bool) -> SFlow a Bool Source #

Return True if any input signals have passed the predicate, False otherwise

sAnyHS :: (a -> Bool) -> Maybe Bool -> SFlow a Bool Source #

Hotswap version of sAny

sAll :: (a -> Bool) -> SFlow a Bool Source #

Return True if all input signals have passed the predicate, False otherwise

sAllHS :: (a -> Bool) -> Maybe Bool -> SFlow a Bool Source #

Hotswap version of sAll

Monoids

sMappend :: Monoid x => SFlow x x Source #

mappend all input signal values

(If you care whether they're appended on the right or left, use sMappendL or sMappendR)

sMappendHS :: Monoid x => Maybe x -> SFlow x x Source #

Hotswap version of sMappend

sMappendL :: Monoid x => SFlow x x Source #

mappend new values onto the left

sMappendLHS :: Monoid x => Maybe x -> SFlow x x Source #

Hotswap version of sMappendL

sMappendR :: Monoid x => SFlow x x Source #

mappend new values onto the right

sMappendRHS :: Monoid x => Maybe x -> SFlow x x Source #

Hotswap version of sMappendR

"List" functions

sToList :: SFlow a [a] Source #

Returns list of all values - at the head of the list is the most-recent element

sToListHS :: Maybe [a] -> SFlow a [a] Source #

sElem :: Eq x => x -> SFlow x Bool Source #

Return True if the input signal has ever contained the element, else False

sNotElem :: Eq x => x -> SFlow x Bool Source #

Return True if the input signal has never contained the element, else False

sMapMaybe :: state -> (update -> Maybe state) -> SFlow update state Source #

sFilterWDefault :: (b -> Bool) -> b -> SFlow b b Source #

sFoldHS :: c -> (a -> c -> c) -> Maybe c -> SFlow a c Source #

Hot-swap in a fold function

First argument is the default value, in case the graph you're replacing hasn't fired at all yet

Counts

sCountJust :: Num n => SFlow (Maybe a) n Source #

Count the number of Just values we've seen

(Useful after e.g. a sFilter)

sCountJustHS :: Num n => Maybe n -> SFlow (Maybe a) n Source #

Hotswap version of sCountJust

sCountJustBy :: Num n => n -> SFlow (Maybe a) n Source #

countJust by steps -- e.g. [0,3,6] instead of [0,1,2]

sCountJustByHS :: Num n => n -> Maybe n -> SFlow (Maybe a) n Source #

Hotswap version of sCountJustBy

sCountFires :: Num n => SFlow x n Source #

Count of all values -- essentially the number of times the SFlow has fired

(If you want to count e.g. what's passed the predicate in sFilter, use sCountJust instead)

sCountFiresBy :: Num n => n -> SFlow x n Source #

sCountFiresByHS :: Num n => n -> Maybe n -> SFlow x n Source #