Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Evt a = Evt {}
- type Bam a = a -> SE ()
- sync :: (Default a, Tuple a) => D -> Evt a -> Evt a
- boolToEvt :: BoolSig -> Evt Unit
- evtToBool :: Evt a -> SE BoolSig
- sigToEvt :: Sig -> Evt Unit
- stepper :: Tuple a => a -> Evt a -> SE a
- filterE :: (a -> BoolD) -> Evt a -> Evt a
- filterSE :: (a -> SE BoolD) -> Evt a -> Evt a
- accumSE :: Tuple s => s -> (a -> s -> SE (b, s)) -> Evt a -> Evt b
- accumE :: Tuple s => s -> (a -> s -> (b, s)) -> Evt a -> Evt b
- filterAccumE :: Tuple s => s -> (a -> s -> (BoolD, b, s)) -> Evt a -> Evt b
- filterAccumSE :: Tuple s => s -> (a -> s -> SE (BoolD, b, s)) -> Evt a -> Evt b
- type family Snap a :: *
- snapshot :: (Tuple a, Tuple (Snap a)) => (Snap a -> b -> c) -> a -> Evt b -> Evt c
- snaps :: Sig -> Evt D
- readSnap :: (Tuple (Snap a), Tuple a) => a -> Snap a
Documentation
A stream of events. We can convert a stream of events to
the procedure with the function runEvt
. It waits for events
and invokes the given procedure when the event happens.
sync :: (Default a, Tuple a) => D -> Evt a -> Evt a Source
Executes actions synchronized with global tempo (in Hz).
runEvtSync tempoCps evt proc
evtToBool :: Evt a -> SE BoolSig Source
Converts an event to boolean signal. It forgets everything about the event values. Signal equals to one when an event happens and zero otherwise.
accumSE :: Tuple s => s -> (a -> s -> SE (b, s)) -> Evt a -> Evt b Source
Accumulator for events with side effects.
filterAccumE :: Tuple s => s -> (a -> s -> (BoolD, b, s)) -> Evt a -> Evt b Source
Accumulator with filtering. It can skip the events from the event stream. If the third element of the triple equals to 1 then we should include the event in the resulting stream. If the element equals to 0 we skip the event.
filterAccumSE :: Tuple s => s -> (a -> s -> SE (BoolD, b, s)) -> Evt a -> Evt b Source
Accumulator for events with side effects and filtering. Event triggers only if the first element in the tripplet is true.
type family Snap a :: * Source
A snapshot of the signal. It converts a type of the signal to the type of the value in the given moment. Instances:
type instance Snap D = D type instance Snap Str = Str type instance Snap Tab = Tab type instance Snap Sig = D type instance Snap (a, b) = (Snap a, Snap b) type instance Snap (a, b, c) = (Snap a, Snap b, Snap c) type instance Snap (a, b, c, d) = (Snap a, Snap b, Snap c, Snap d) type instance Snap (a, b, c, d, e) = (Snap a, Snap b, Snap c, Snap d, Snap e) type instance Snap (a, b, c, d, e, f) = (Snap a, Snap b, Snap c, Snap d, Snap e, Snap f)
type Snap Tab = Tab | |
type Snap Str = Str | |
type Snap D = D | |
type Snap Sig = D | |
type Snap (a, b) = (Snap a, Snap b) | |
type Snap (a, b, c) = (Snap a, Snap b, Snap c) | |
type Snap (a, b, c, d) = (Snap a, Snap b, Snap c, Snap d) | |
type Snap (a, b, c, d, e) = (Snap a, Snap b, Snap c, Snap d, Snap e) | |
type Snap (a, b, c, d, e, f) = (Snap a, Snap b, Snap c, Snap d, Snap e, Snap f) |
snapshot :: (Tuple a, Tuple (Snap a)) => (Snap a -> b -> c) -> a -> Evt b -> Evt c Source
Get values of some signal at the given events.
Constructs an event stream that contains values from the given signal. Events happens only when the signal changes.