Safe Haskell | Trustworthy |
---|---|
Language | Haskell98 |
- newtype Event t = Event {}
- eFromML :: [Measurement t] -> Event t
- nonDispatchedIO :: IO t -> Event t
- runEvent :: Event t -> (t -> POSIXTime -> IO ()) -> IO ()
- class (Functor e, MonadPlus e) => EventStream e where
- filterMaybes :: MonadPlus m => m (Maybe t) -> m t
- delay :: EventStream m => POSIXTime -> m t -> m t
- delays :: (EventStream e, MonadIO e) => e (t, POSIXTime) -> e t
- fmap' :: (Measurement t -> Measurement u) -> [Measurement t] -> Event u
- scan' :: (t1 -> Measurement t2 -> (t1, Measurement t)) -> t1 -> [Measurement t2] -> Event t
Documentation
Event streams are here presented using the publisher-subscriber model (push-based handling
in contrast to the pull-based handling of MeasurementWrapper
). Such an event
is represented by a subscription function and a callback. The subscription function finishes fast allowing
the caller to continue.
The motivation for introducing this data type is that, while the 'Measurement'/'MeasurementWrapper' system is fast, its intensive use of memory cells that need to be garbage collected means that it may not be fast enough for some purposes.
eFromML :: [Measurement t] -> Event t Source #
nonDispatchedIO :: IO t -> Event t Source #
runEvent :: Event t -> (t -> POSIXTime -> IO ()) -> IO () Source #
Run an event -- see .Basic module for a way to run with a Windows event loop.
A minimal set of combinators
class (Functor e, MonadPlus e) => EventStream e where Source #
eventFromList :: [(t, POSIXTime)] -> e t Source #
Prooty self-explanatory.
scan :: (t -> u -> (t, v)) -> t -> e u -> e v Source #
The "scan" primitive is analogous to "scanl" for lists.
switch :: e (e t) -> e t Source #
A primitive like "switch" is the main way of implementing behaviors that can be switched in and out as required.
withRemainder :: e t -> e (t, e t) Source #
The main use of "withRemainder" is to implement manual aging of inputs. It helps prevent space and time leaks.
channel :: IO (t -> IO (), e t) Source #
Construct a channel in order to receive external events.
adjoinTime :: e t -> e (t, POSIXTime) Source #
Gets the current time along with every occurrence.
filterMaybes :: MonadPlus m => m (Maybe t) -> m t Source #
delay :: EventStream m => POSIXTime -> m t -> m t Source #
Optimizer rules
fmap' :: (Measurement t -> Measurement u) -> [Measurement t] -> Event u Source #
scan' :: (t1 -> Measurement t2 -> (t1, Measurement t)) -> t1 -> [Measurement t2] -> Event t Source #