rhine-0.5.1.0: Functional Reactive Programming with type-level clocks

Safe HaskellNone
LanguageHaskell2010

FRP.Rhine.Clock.Select

Description

In the Rhine philosophy, _event sources are clocks_. Often, we want to extract certain subevents from event sources, e.g. single out only left mouse button clicks from all input device events. This module provides a general purpose selection clock that ticks only on certain subevents.

Synopsis

Documentation

data SelectClock cl a Source #

A clock that selects certain subevents of type a, from the tag of a main clock.

If two SelectClocks would tick on the same type of subevents, but should not have the same type, one should newtype the subevent.

Constructors

SelectClock 

Fields

  • mainClock :: cl

    The main clock | Return Nothing if no tick of the subclock is required, or 'Just a' if the subclock should tick, with tag a.

  • select :: Tag cl -> Maybe a
     
Instances
(Monad m, Clock m cl) => Clock m (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Associated Types

type Time (SelectClock cl a) :: Type Source #

type Tag (SelectClock cl a) :: Type Source #

type Time (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

type Time (SelectClock cl a) = Time cl
type Tag (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

type Tag (SelectClock cl a) = a

schedSelectClocks :: (Monad m, Semigroup cl, Clock m cl) => Schedule m (SelectClock cl a) (SelectClock cl b) Source #

A universal schedule for two subclocks of the same main clock. The main clock must be a Semigroup (e.g. a singleton).

schedSelectClockAndMain :: (Monad m, Semigroup cl, Clock m cl) => Schedule m cl (SelectClock cl a) Source #

A universal schedule for a subclock and its main clock.

filterS :: Monad m => MSF m () (Maybe b) -> MSF m () b Source #

Helper function that runs an MSF with Maybe output until it returns a value.