rhine-1.1: Functional Reactive Programming with type-level clocks
Safe HaskellSafe-Inferred
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

Instances details
(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) Source #

type Tag (SelectClock cl a) Source #

(Monoid cl, Semigroup a) => Monoid (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Methods

mempty :: SelectClock cl a #

mappend :: SelectClock cl a -> SelectClock cl a -> SelectClock cl a #

mconcat :: [SelectClock cl a] -> SelectClock cl a #

(Semigroup a, Semigroup cl) => Semigroup (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Methods

(<>) :: SelectClock cl a -> SelectClock cl a -> SelectClock cl a #

sconcat :: NonEmpty (SelectClock cl a) -> SelectClock cl a #

stimes :: Integral b => b -> SelectClock cl a -> SelectClock cl a #

GetClockProxy (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

type Tag (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

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

Defined in FRP.Rhine.Clock.Select

type Time (SelectClock cl a) = Time cl

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.