netwire-5.0.3: Functional reactive programming library

Copyright | (c) 2013 Ertugrul Soeylemez
License | BSD3
Maintainer | Ertugrul Soeylemez <es@ertes.de>
Safe Haskell | None
Language | Haskell2010

Control.Wire.Unsafe.Event

Contents

- Events
- Helper functions

Description

Synopsis

- data Event a
  - = Event a
  - | NoEvent
- event :: b -> (a -> b) -> Event a -> b
- merge :: (a -> a -> a) -> Event a -> Event a -> Event a
- occurred :: Event a -> Bool
- onEventM :: Monad m => (a -> m b) -> Wire s e m (Event a) (Event b)

# Events

data Event a Source #

Denotes a stream of values, each together with time of occurrence. Since `Event` is commonly used for functional reactive programming it does not define most of the usual instances to protect continuous time and discrete event occurrence semantics.

Constructors

Event a |
NoEvent |

#### Instances

Instances details

Functor Event Source # |
Instance details Defined in Control.Wire.Unsafe.Event Methods fmap :: (a -> b) -> Event a -> Event b Source # (<$) :: a -> Event b -> Event a Source #
NFData a => NFData (Event a) Source # |
Instance details Defined in Control.Wire.Unsafe.Event Methods rnf :: Event a -> () Source #
Semigroup a => Monoid (Event a) Source # |
Instance details Defined in Control.Wire.Unsafe.Event Methods mempty :: Event a Source # mappend :: Event a -> Event a -> Event a Source # mconcat :: [Event a] -> Event a Source #
Semigroup a => Semigroup (Event a) Source # |
Instance details Defined in Control.Wire.Unsafe.Event Methods (<>) :: Event a -> Event a -> Event a Source # sconcat :: NonEmpty (Event a) -> Event a Source # stimes :: Integral b => b -> Event a -> Event a Source #

# Helper functions

event :: b -> (a -> b) -> Event a -> b Source #

Fold the given event.

merge :: (a -> a -> a) -> Event a -> Event a -> Event a Source #

Merge two events using the given function when both occur at the same time.

occurred :: Event a -> Bool Source #

Did the given event occur?

onEventM :: Monad m => (a -> m b) -> Wire s e m (Event a) (Event b) Source #

Each time the given event occurs, perform the given action with the value the event carries. The resulting event carries the result of the action.

- Depends: now.