netwire-4.0.1: Flexible wire arrows for FRP

Copyright(c) 2012 Ertugrul Soeylemez
LicenseBSD3
MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone
LanguageHaskell2010

Control.Wire.Trans.Switch

Contents

Description

Switching combinators. Notice that these combinators restart time when switching.

Synopsis

Simple switching

andThen infixr 1 Source

Arguments

:: Monad m 
=> Wire e m a b

Wire to start with.

-> Wire e m a b

Wire to switch into.

-> Wire e m a b 

Behaves like the first wire until it inhibits. Switches to the second wire as soon as the first one inhibits.

The andThen operator is right-associative with precedence 1.

  • Depends: like currently active wire.
  • Inhibits: when switched to second wire and that one inhibits.
  • Time: switching restarts time.

switch Source

Arguments

:: Monad m 
=> Wire e m a (Wire e m a b)

Produces a wire to switch into.

-> Wire e m a b

Initial wire.

-> Wire e m a b 

If the first argument wire produces a wire, switch to it immediately. If not, evolve the current wire. The second argument wire is the initial wire.

  • Depends: like event wire and the currently active wire.
  • Inhibits: when the currently active wire inhibits.
  • Time: switching restarts time.

switchBy Source

Arguments

:: Monad m 
=> (e' -> Wire e' m a b)

Wire selection function.

-> Wire e' m a b

Initial wire.

-> Wire e m a b 

Whenever the given wire inhibits, a new wire is constructed using the given function.

  • Depends: like currently active wire.
  • Time: switching restarts time.

(-->) :: Monad m => Wire e m a b -> Wire e m a b -> Wire e m a b infixr 1 Source

Infix variant of andThen.

This operator is right-associative with precedence 1.