timeless-0.9.0.1: An Arrow based Functional Reactive Programming library

Copyright(c) 2015 Rongcui Dong
LicenseBSD3
MaintainerRongcui Dong <karl_1702@188.com>
Safe HaskellSafe
LanguageHaskell2010

FRP.Timeless.Prefab.Discrete

Contents

Description

 

Synopsis

Discrete Signals

occursFor Source #

Arguments

:: Monad m 
=> b

Constant Output

-> Int

Number of sample periods

-> Signal s m a b 

Produces output for a several sample periods, then inhibits.

Typical usage:

() `occursFor` 1 >>> <some IO actions> >>> snapOnce

The example above will perform the IO action once and then hold the result forever

impulse :: Monad m => b -> Signal s m a b Source #

A value that appears for a semantically infinitely short period of time

oneShot :: Monad m => b -> Signal s m a b Source #

snapOnce :: Monad m => Signal s m a a Source #

Takes the snapshot of the value when signal is activated, and then holds value forever

Typical usage:

() `occursFor` 1 >>> <some IO actions> >>> snapOnce

The example above will perform the IO action once and then hold the result forever

inhibitsAfterPeriods :: Int -> Signal s m a a Source #

Acts as identity for a several sample periods, then inhibits.

runAndHold :: Monad m => Signal s m a b -> Signal s m a b Source #

Runs a signal once and hold the result forever.

It is a combination of inhibitsAfter and snapOnce

Logic Signals

rising Source #

Arguments

:: Monad m 
=> Bool

Initial value

-> Signal s m Bool Bool 

Rising edge filter. Creates an impulse at rising edge

falling Source #

Arguments

:: Monad m 
=> Bool

Initial value

-> Signal s m Bool Bool 

Falling edge filter. Creates an impulse at falling edge

edge Source #

Arguments

:: Monad m 
=> Bool

Initial value

-> Signal s m Bool Bool 

Edge filter. Creates an impulse at edge

latch Source #

Arguments

:: Monad m 
=> Bool

Initial value

-> Signal s m (Bool, Bool) Bool 

A Set-Reset latch, with the first input set, second input reset. Current output value has higher priority (Prefer lazy!)

latchS :: Monad m => Signal s m Bool Bool Source #

A set-latch whose initial value is False, but turns True and holds when its input becomes true

latchR :: Monad m => Signal s m Bool Bool Source #

A reset-latch whose initial value is True, but turns False and holds when its input becomes false