Yampa-0.10.1.1: Library for programming hybrid systems.

Copyright(c) Antony Courtney and Henrik Nilsson, Yale University, 2003
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainerivan.perez@keera.co.uk
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell98

FRP.Yampa.EventS

Contents

Description

 

Synopsis

Basic event sources

never :: SF a (Event b) Source

Event source that never occurs.

now :: b -> SF a (Event b) Source

Event source with a single occurrence at time 0. The value of the event is given by the function argument.

after Source

Arguments

:: Time

The time q after which the event should be produced

-> b

Value to produce at that time

-> SF a (Event b) 

Event source with a single occurrence at or as soon after (local) time q as possible.

repeatedly :: Time -> b -> SF a (Event b) Source

Event source with repeated occurrences with interval q. Note: If the interval is too short w.r.t. the sampling intervals, the result will be that events occur at every sample. However, no more than one event results from any sampling interval, thus avoiding an "event backlog" should sampling become more frequent at some later point in time.

afterEach :: [(Time, b)] -> SF a (Event b) Source

Event source with consecutive occurrences at the given intervals. Should more than one event be scheduled to occur in any sampling interval, only the first will in fact occur to avoid an event backlog.

afterEachCat :: [(Time, b)] -> SF a (Event [b]) Source

Event source with consecutive occurrences at the given intervals. Should more than one event be scheduled to occur in any sampling interval, the output list will contain all events produced during that interval.

delayEvent :: Time -> SF (Event a) (Event a) Source

Delay for events. (Consider it a triggered after, hence basic.)

delayEventCat :: Time -> SF (Event a) (Event [a]) Source

Delay an event by a given delta and catenate events that occur so closely so as to be inseparable.

edge :: SF Bool (Event ()) Source

A rising edge detector. Useful for things like detecting key presses. It is initialised as up, meaning that events occuring at time 0 will not be detected.

iEdge :: Bool -> SF Bool (Event ()) Source

A rising edge detector that can be initialized as up (True, meaning that events occurring at time 0 will not be detected) or down (False, meaning that events ocurring at time 0 will be detected).

edgeTag :: a -> SF Bool (Event a) Source

Like edge, but parameterized on the tag value.

edgeJust :: SF (Maybe a) (Event a) Source

Edge detector particularized for detecting transtitions on a Maybe signal from Nothing to Just.

edgeBy :: (a -> a -> Maybe b) -> a -> SF a (Event b) Source

Edge detector parameterized on the edge detection function and initial state, i.e., the previous input sample. The first argument to the edge detection function is the previous sample, the second the current one.

Stateful event suppression

notYet :: SF (Event a) (Event a) Source

Suppression of initial (at local time 0) event.

once :: SF (Event a) (Event a) Source

Suppress all but the first event.

takeEvents :: Int -> SF (Event a) (Event a) Source

Suppress all but the first n events.

dropEvents :: Int -> SF (Event a) (Event a) Source

Suppress first n events.

Pointwise functions on events

snap :: SF a (Event a) Source

sample :: Time -> SF a (Event a) Source

recur :: SF a (Event b) -> SF a (Event b) Source

andThen :: SF a (Event b) -> SF a (Event b) -> SF a (Event b) infixr 5 Source