Rattus-0.1.1.0: A modal FRP language

Safe HaskellNone
LanguageHaskell2010

Rattus.Yampa

Description

A simply Yampa-like library for signal functions.

Synopsis

Documentation

data SF a b Source #

Signal functions from inputs of type a to outputs of type b.

Instances
Arrow SF Source # 
Instance details

Defined in Rattus.Yampa

Methods

arrBox :: Box (b -> c) -> SF b c Source #

first :: SF b c -> SF (b, d) (c, d) Source #

second :: SF b c -> SF (d, b) (d, c) Source #

(***) :: SF b c -> SF b' c' -> SF (b, b') (c, c') Source #

(&&&) :: SF b c -> SF b c' -> SF b (c, c') Source #

Category SF Source # 
Instance details

Defined in Rattus.Yampa

Methods

id :: SF a a #

(.) :: SF b c -> SF a b -> SF a c #

identity :: SF a a Source #

The identity signal function that does nothing.

compose :: SF b c -> SF a b -> SF a c Source #

Compose two signal functions.

switch :: SF a (b, Maybe' c) -> Box (c -> SF a b) -> SF a b Source #

switch s f behaves like s composed with arr fst until s produces a value of the form Just' c in the second component. From then on it behaves like $f c@.

rSwitch :: SF a b -> SF (a, Maybe' (SF a b)) b Source #

rSwitch s behaves like s, but every time the second input is of the form Just' s' it will change behaviour to s'.

constant :: Stable b => b -> SF a b Source #

Constant signal function.

loopPre :: c -> SF (a, c) (b, O c) -> SF a b Source #

Loop with an initial value for the signal being fed back.

Note: The type of loopPre is different from Yampa's as we need the O type here.

stepSF :: SF a b -> DTime -> a -> (O (SF a b), b) Source #

Run a signal function for one step.

initially :: a -> SF a a Source #

Override initial value of input signal.

integral :: (Stable a, VectorSpace a s) => a -> SF a a Source #

Compute the integral of a signal. The first argument is the offset.

(-->) :: b -> SF a b -> SF a b Source #

The output at time zero is the first argument, and from that point on it behaves like the signal function passed as second argument.

(-:>) :: b -> O (SF a b) -> SF a b Source #

Insert a sample in the output, and from that point on, behave like the given signal function.

Note: The type of -:> is different from Yampa's: The second argument must be delayed (or boxed).

(>--) :: a -> SF a b -> SF a b Source #

The input at time zero is the first argument, and from that point on it behaves like the signal function passed as second argument.

(-=>) :: (b -> b) -> SF a b -> SF a b Source #

Apply a function to the first output value at time zero.

(>=-) :: (a -> a) -> SF a b -> SF a b Source #

Apply a function to the first input value at time zero.

(^>>) :: Arrow a => Box (b -> c) -> a c d -> a b d Source #

Precomposition with a pure function.

(>>^) :: Arrow a => a b c -> Box (c -> d) -> a b d Source #

Postcomposition with a pure function.

(<<^) :: Arrow a => a c d -> Box (b -> c) -> a b d Source #

Precomposition with a pure function (right-to-left variant).

(^<<) :: Arrow a => Box (c -> d) -> a b c -> a b d Source #

Postcomposition with a pure function (right-to-left variant).

(>>>) :: Category cat => cat a b -> cat b c -> cat a c infixr 1 #

Left-to-right composition