bearriver-0.13.1: A replacement of Yampa based on Monadic Stream Functions.

Safe HaskellNone
LanguageHaskell2010

FRP.Yampa

Synopsis

Documentation

leftApp :: ArrowApply a => a b c -> a (Either b d) (Either c d) #

Any instance of ArrowApply can be made into an instance of ArrowChoice by defining left = leftApp.

(^<<) :: Arrow a => (c -> d) -> a b c -> a b d infixr 1 #

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

(<<^) :: Arrow a => a c d -> (b -> c) -> a b d infixr 1 #

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

(>>^) :: Arrow a => a b c -> (c -> d) -> a b d infixr 1 #

Postcomposition with a pure function.

(^>>) :: Arrow a => (b -> c) -> a c d -> a b d infixr 1 #

Precomposition with a pure function.

returnA :: Arrow a => a b b #

The identity arrow, which plays the role of return in arrow notation.

class Category a => Arrow (a :: Type -> Type -> Type) where #

The basic arrow class.

Instances should satisfy the following laws:

where

assoc ((a,b),c) = (a,(b,c))

The other combinators have sensible default definitions, which may be overridden for efficiency.

Minimal complete definition

arr, (first | (***))

Methods

arr :: (b -> c) -> a b c #

Lift a function to an arrow.

first :: a b c -> a (b, d) (c, d) #

Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.

second :: a b c -> a (d, b) (d, c) #

A mirror image of first.

The default definition may be overridden with a more efficient version if desired.

(***) :: a b c -> a b' c' -> a (b, b') (c, c') infixr 3 #

Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

(&&&) :: a b c -> a b c' -> a b (c, c') infixr 3 #

Fanout: send the input to both argument arrows and combine their output.

The default definition may be overridden with a more efficient version if desired.

Instances
Monad m => Arrow (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

arr :: (b -> c) -> Kleisli m b c #

first :: Kleisli m b c -> Kleisli m (b, d) (c, d) #

second :: Kleisli m b c -> Kleisli m (d, b) (d, c) #

(***) :: Kleisli m b c -> Kleisli m b' c' -> Kleisli m (b, b') (c, c') #

(&&&) :: Kleisli m b c -> Kleisli m b c' -> Kleisli m b (c, c') #

Arrow ((->) :: Type -> Type -> Type)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

arr :: (b -> c) -> b -> c #

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

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

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

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

newtype Kleisli (m :: Type -> Type) a b #

Kleisli arrows of a monad.

Constructors

Kleisli 

Fields

Instances
Monad m => Arrow (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

arr :: (b -> c) -> Kleisli m b c #

first :: Kleisli m b c -> Kleisli m (b, d) (c, d) #

second :: Kleisli m b c -> Kleisli m (d, b) (d, c) #

(***) :: Kleisli m b c -> Kleisli m b' c' -> Kleisli m (b, b') (c, c') #

(&&&) :: Kleisli m b c -> Kleisli m b c' -> Kleisli m b (c, c') #

MonadPlus m => ArrowZero (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

zeroArrow :: Kleisli m b c #

MonadPlus m => ArrowPlus (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

(<+>) :: Kleisli m b c -> Kleisli m b c -> Kleisli m b c #

Monad m => ArrowChoice (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

left :: Kleisli m b c -> Kleisli m (Either b d) (Either c d) #

right :: Kleisli m b c -> Kleisli m (Either d b) (Either d c) #

(+++) :: Kleisli m b c -> Kleisli m b' c' -> Kleisli m (Either b b') (Either c c') #

(|||) :: Kleisli m b d -> Kleisli m c d -> Kleisli m (Either b c) d #

Monad m => ArrowApply (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

app :: Kleisli m (Kleisli m b c, b) c #

MonadFix m => ArrowLoop (Kleisli m)

Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class.

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

loop :: Kleisli m (b, d) (c, d) -> Kleisli m b c #

Monad m => Category (Kleisli m :: Type -> Type -> Type)

Since: base-3.0

Instance details

Defined in Control.Arrow

Methods

id :: Kleisli m a a #

(.) :: Kleisli m b c -> Kleisli m a b -> Kleisli m a c #

class Arrow a => ArrowZero (a :: Type -> Type -> Type) where #

Methods

zeroArrow :: a b c #

Instances
MonadPlus m => ArrowZero (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

zeroArrow :: Kleisli m b c #

class ArrowZero a => ArrowPlus (a :: Type -> Type -> Type) where #

A monoid on arrows.

Methods

(<+>) :: a b c -> a b c -> a b c infixr 5 #

An associative operation with identity zeroArrow.

Instances
MonadPlus m => ArrowPlus (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

(<+>) :: Kleisli m b c -> Kleisli m b c -> Kleisli m b c #

class Arrow a => ArrowChoice (a :: Type -> Type -> Type) where #

Choice, for arrows that support it. This class underlies the if and case constructs in arrow notation.

Instances should satisfy the following laws:

where

assocsum (Left (Left x)) = Left x
assocsum (Left (Right y)) = Right (Left y)
assocsum (Right z) = Right (Right z)

The other combinators have sensible default definitions, which may be overridden for efficiency.

Minimal complete definition

(left | (+++))

Methods

left :: a b c -> a (Either b d) (Either c d) #

Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.

right :: a b c -> a (Either d b) (Either d c) #

A mirror image of left.

The default definition may be overridden with a more efficient version if desired.

(+++) :: a b c -> a b' c' -> a (Either b b') (Either c c') infixr 2 #

Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

(|||) :: a b d -> a c d -> a (Either b c) d infixr 2 #

Fanin: Split the input between the two argument arrows and merge their outputs.

The default definition may be overridden with a more efficient version if desired.

Instances
Monad m => ArrowChoice (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

left :: Kleisli m b c -> Kleisli m (Either b d) (Either c d) #

right :: Kleisli m b c -> Kleisli m (Either d b) (Either d c) #

(+++) :: Kleisli m b c -> Kleisli m b' c' -> Kleisli m (Either b b') (Either c c') #

(|||) :: Kleisli m b d -> Kleisli m c d -> Kleisli m (Either b c) d #

ArrowChoice ((->) :: Type -> Type -> Type)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

left :: (b -> c) -> Either b d -> Either c d #

right :: (b -> c) -> Either d b -> Either d c #

(+++) :: (b -> c) -> (b' -> c') -> Either b b' -> Either c c' #

(|||) :: (b -> d) -> (c -> d) -> Either b c -> d #

class Arrow a => ArrowApply (a :: Type -> Type -> Type) where #

Some arrows allow application of arrow inputs to other inputs. Instances should satisfy the following laws:

Such arrows are equivalent to monads (see ArrowMonad).

Methods

app :: a (a b c, b) c #

Instances
Monad m => ArrowApply (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

app :: Kleisli m (Kleisli m b c, b) c #

ArrowApply ((->) :: Type -> Type -> Type)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

app :: (b -> c, b) -> c #

newtype ArrowMonad (a :: Type -> Type -> Type) b #

The ArrowApply class is equivalent to Monad: any monad gives rise to a Kleisli arrow, and any instance of ArrowApply defines a monad.

Constructors

ArrowMonad (a () b) 
Instances
ArrowApply a => Monad (ArrowMonad a)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

(>>=) :: ArrowMonad a a0 -> (a0 -> ArrowMonad a b) -> ArrowMonad a b #

(>>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b #

return :: a0 -> ArrowMonad a a0 #

fail :: String -> ArrowMonad a a0 #

Arrow a => Functor (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

fmap :: (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b #

(<$) :: a0 -> ArrowMonad a b -> ArrowMonad a a0 #

Arrow a => Applicative (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

pure :: a0 -> ArrowMonad a a0 #

(<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b #

liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c #

(*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b #

(<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 #

(ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

mzero :: ArrowMonad a a0 #

mplus :: ArrowMonad a a0 -> ArrowMonad a a0 -> ArrowMonad a a0 #

ArrowPlus a => Alternative (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

empty :: ArrowMonad a a0 #

(<|>) :: ArrowMonad a a0 -> ArrowMonad a a0 -> ArrowMonad a a0 #

some :: ArrowMonad a a0 -> ArrowMonad a [a0] #

many :: ArrowMonad a a0 -> ArrowMonad a [a0] #

class Arrow a => ArrowLoop (a :: Type -> Type -> Type) where #

The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec value recursion construct in arrow notation. loop should satisfy the following laws:

extension
loop (arr f) = arr (\ b -> fst (fix (\ (c,d) -> f (b,d))))
left tightening
loop (first h >>> f) = h >>> loop f
right tightening
loop (f >>> first h) = loop f >>> h
sliding
loop (f >>> arr (id *** k)) = loop (arr (id *** k) >>> f)
vanishing
loop (loop f) = loop (arr unassoc >>> f >>> arr assoc)
superposing
second (loop f) = loop (arr assoc >>> second f >>> arr unassoc)

where

assoc ((a,b),c) = (a,(b,c))
unassoc (a,(b,c)) = ((a,b),c)

Methods

loop :: a (b, d) (c, d) -> a b c #

Instances
MonadFix m => ArrowLoop (Kleisli m)

Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class.

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

loop :: Kleisli m (b, d) (c, d) -> Kleisli m b c #

ArrowLoop ((->) :: Type -> Type -> Type)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

loop :: ((b, d) -> (c, d)) -> b -> c #

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

Left-to-right composition

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

Right-to-left composition

pauseOn :: Show a => (a -> Bool) -> String -> MSF IO a a #

Outputs every input sample, with a given message prefix, when a condition is met, and waits for some input / enter to continue.

traceWhen :: (Monad m, Show a) => (a -> Bool) -> (String -> m ()) -> String -> MSF m a a #

Outputs every input sample, with a given message prefix, using an auxiliary printing function, when a condition is met.

traceWith :: (Monad m, Show a) => (String -> m ()) -> String -> MSF m a a #

Outputs every input sample, with a given message prefix, using an auxiliary printing function.

unfold :: Monad m => (a -> (b, a)) -> a -> MSF m () b #

Generate outputs using a step-wise generation function and an initial value.

mealy :: Monad m => (a -> s -> (b, s)) -> s -> MSF m a b #

Applies a transfer function to the input and an accumulator, returning the updated accumulator and output.

accumulateWith :: Monad m => (a -> s -> s) -> s -> MSF m a s #

Applies a function to the input and an accumulator, outputting the updated accumulator. Equal to f s0 -> feedback s0 $ arr (uncurry f >>> dup).

mappendFrom :: (Monoid n, Monad m) => n -> MSF m n n #

Accumulate the inputs, starting from an initial monoid value.

mappendS :: (Monoid n, Monad m) => MSF m n n #

Accumulate the inputs, starting from mempty.

sumFrom :: (RModule v, Monad m) => v -> MSF m v v #

Sums the inputs, starting from an initial vector.

sumS :: (RModule v, Monad m) => MSF m v v #

Sums the inputs, starting from zero.

count :: (Num n, Monad m) => MSF m a n #

Count the number of simulation steps. Produces 1, 2, 3,...

fifo :: Monad m => MSF m [a] (Maybe a) #

Buffers and returns the elements in FIFO order, returning Nothing whenever the buffer is empty.

next :: Monad m => b -> MSF m a b -> MSF m a b #

Preprends a fixed output to an MSF, shifting the output.

iPost :: Monad m => b -> MSF m a b -> MSF m a b #

Preprends a fixed output to an MSF. The first input is completely ignored.

iPre #

Arguments

:: Monad m 
=> a

First output

-> MSF m a a 

Delay a signal by one sample.

withSideEffect_ :: Monad m => m b -> MSF m a a #

Produces an additional side effect and passes the input unchanged.

withSideEffect :: Monad m => (a -> m b) -> MSF m a a #

Applies a function to produce an additional side effect and passes the input unchanged.

mapMaybeS :: Monad m => MSF m a b -> MSF m (Maybe a) (Maybe b) #

Apply an MSF to every input. Freezes temporarily if the input is Nothing, and continues as soon as a Just is received.

type MStream (m :: Type -> Type) a = MSF m () a #

A stream is an MSF that produces outputs, while ignoring the input. It can obtain the values from a monadic context.

type MSink (m :: Type -> Type) a = MSF m a () #

A sink is an MSF that consumes inputs, while producing no output. It can consume the values with side effects.

morphS :: (Monad m2, Monad m1) => (forall c. m1 c -> m2 c) -> MSF m1 a b -> MSF m2 a b #

Apply trans-monadic actions (in an arbitrary way).

This is just a convenience function when you have a function to move across monads, because the signature of morphGS is a bit complex.

liftTransS :: (MonadTrans t, Monad m, Monad (t m)) => MSF m a b -> MSF (t m) a b #

Lift inner monadic actions in monad stacks.

(>>>^) :: MonadBase m1 m2 => MSF m2 a b -> MSF m1 b c -> MSF m2 a c #

Lift the second MSF into the monad of the first.

(^>>>) :: MonadBase m1 m2 => MSF m1 a b -> MSF m2 b c -> MSF m2 a c #

Lift the first MSF into the monad of the second.

liftBaseS :: (Monad m2, MonadBase m1 m2) => MSF m1 a b -> MSF m2 a b #

Lift innermost monadic actions in monad stack (generalisation of liftIO).

liftBaseM :: (Monad m2, MonadBase m1 m2) => (a -> m1 b) -> MSF m2 a b #

Monadic lifting from one monad into another

arrM :: Monad m => (a -> m b) -> MSF m a b #

Apply a monadic transformation to every element of the input stream.

Generalisation of arr from Arrow to monadic functions.

constM :: Monad m => m b -> MSF m a b #

Lifts a monadic computation into a Stream.

embed :: Monad m => MSF m a b -> [a] -> m [b] #

Apply a monadic stream function to a list.

Because the result is in a monad, it may be necessary to traverse the whole list to evaluate the value in the results to WHNF. For example, if the monad is the maybe monad, this may not produce anything if the MSF produces Nothing at any point, so the output stream cannot consumed progressively.

To explore the output progressively, use liftMSF and '(>>>)'', together with some action that consumes/actuates on the output.

This is called runSF in Liu, Cheng, Hudak, "Causal Commutative Arrows and Their Optimization"

feedback :: Monad m => c -> MSF m (a, c) (b, c) -> MSF m a b #

Well-formed looped connection of an output component as a future input.

morphGS #

Arguments

:: Monad m2 
=> (forall c. (a1 -> m1 (b1, c)) -> a2 -> m2 (b2, c))

The natural transformation. mi, ai and bi for i = 1, 2 can be chosen freely, but c must be universally quantified

-> MSF m1 a1 b1 
-> MSF m2 a2 b2 

Generic lifting of a morphism to the level of MSFs.

Natural transformation to the level of MSFs.

Mathematical background: The type a -> m (b, c) is a functor in c, and MSF m a b is its greatest fixpoint, i.e. it is isomorphic to the type a -> m (b, MSF m a b), by definition. The types m, a and b are parameters of the functor. Taking a fixpoint is functorial itself, meaning that a morphism (a natural transformation) of two such functors gives a morphism (an ordinary function) of their fixpoints.

This is in a sense the most general "abstract" lifting function, i.e. the most general one that only changes input, output and side effect types, and doesn't influence control flow. Other handling functions like exception handling or ListT broadcasting necessarily change control flow.

data MSF (m :: Type -> Type) a b #

Stepwise, side-effectful MSFs without implicit knowledge of time.

MSFs should be applied to streams or executed indefinitely or until they terminate. See reactimate and reactimateB for details. In general, calling the value constructor MSF or the function unMSF is discouraged.

Instances
Monad m => Category (MSF m :: Type -> Type -> Type)

Instance definition for Category. Defines id and ..

Instance details

Defined in Data.MonadicStreamFunction.InternalCore

Methods

id :: MSF m a a #

(.) :: MSF m b c -> MSF m a b -> MSF m a c #

class (Eq a, Floating a) => VectorSpace v a | v -> a where Source #

Minimal complete definition

zeroVector, (*^), (^+^), dot

Methods

zeroVector :: v Source #

(*^) :: a -> v -> v infixr 9 Source #

(^/) :: v -> a -> v infixl 9 Source #

negateVector :: v -> v Source #

(^+^) :: v -> v -> v infixl 6 Source #

(^-^) :: v -> v -> v infixl 6 Source #

dot :: v -> v -> a infix 7 Source #

norm :: v -> a Source #

normalize :: v -> v Source #

Instances
VectorSpace Double Double Source # 
Instance details

Defined in FRP.Yampa.VectorSpace

VectorSpace Float Float Source # 
Instance details

Defined in FRP.Yampa.VectorSpace

RealFloat a => VectorSpace (Vector3 a) a Source # 
Instance details

Defined in FRP.Yampa.Vector3

RealFloat a => VectorSpace (Vector2 a) a Source # 
Instance details

Defined in FRP.Yampa.Vector2

(Eq a, Floating a) => VectorSpace (a, a) a Source # 
Instance details

Defined in FRP.Yampa.VectorSpace

Methods

zeroVector :: (a, a) Source #

(*^) :: a -> (a, a) -> (a, a) Source #

(^/) :: (a, a) -> a -> (a, a) Source #

negateVector :: (a, a) -> (a, a) Source #

(^+^) :: (a, a) -> (a, a) -> (a, a) Source #

(^-^) :: (a, a) -> (a, a) -> (a, a) Source #

dot :: (a, a) -> (a, a) -> a Source #

norm :: (a, a) -> a Source #

normalize :: (a, a) -> (a, a) Source #

(Eq a, Floating a) => VectorSpace (a, a, a) a Source # 
Instance details

Defined in FRP.Yampa.VectorSpace

Methods

zeroVector :: (a, a, a) Source #

(*^) :: a -> (a, a, a) -> (a, a, a) Source #

(^/) :: (a, a, a) -> a -> (a, a, a) Source #

negateVector :: (a, a, a) -> (a, a, a) Source #

(^+^) :: (a, a, a) -> (a, a, a) -> (a, a, a) Source #

(^-^) :: (a, a, a) -> (a, a, a) -> (a, a, a) Source #

dot :: (a, a, a) -> (a, a, a) -> a Source #

norm :: (a, a, a) -> a Source #

normalize :: (a, a, a) -> (a, a, a) Source #

(Eq a, Floating a) => VectorSpace (a, a, a, a) a Source # 
Instance details

Defined in FRP.Yampa.VectorSpace

Methods

zeroVector :: (a, a, a, a) Source #

(*^) :: a -> (a, a, a, a) -> (a, a, a, a) Source #

(^/) :: (a, a, a, a) -> a -> (a, a, a, a) Source #

negateVector :: (a, a, a, a) -> (a, a, a, a) Source #

(^+^) :: (a, a, a, a) -> (a, a, a, a) -> (a, a, a, a) Source #

(^-^) :: (a, a, a, a) -> (a, a, a, a) -> (a, a, a, a) Source #

dot :: (a, a, a, a) -> (a, a, a, a) -> a Source #

norm :: (a, a, a, a) -> a Source #

normalize :: (a, a, a, a) -> (a, a, a, a) Source #

(Eq a, Floating a) => VectorSpace (a, a, a, a, a) a Source # 
Instance details

Defined in FRP.Yampa.VectorSpace

Methods

zeroVector :: (a, a, a, a, a) Source #

(*^) :: a -> (a, a, a, a, a) -> (a, a, a, a, a) Source #

(^/) :: (a, a, a, a, a) -> a -> (a, a, a, a, a) Source #

negateVector :: (a, a, a, a, a) -> (a, a, a, a, a) Source #

(^+^) :: (a, a, a, a, a) -> (a, a, a, a, a) -> (a, a, a, a, a) Source #

(^-^) :: (a, a, a, a, a) -> (a, a, a, a, a) -> (a, a, a, a, a) Source #

dot :: (a, a, a, a, a) -> (a, a, a, a, a) -> a Source #

norm :: (a, a, a, a, a) -> a Source #

normalize :: (a, a, a, a, a) -> (a, a, a, a, a) Source #

data RealFloat a => Vector3 a Source #

Instances
RealFloat a => Eq (Vector3 a) Source # 
Instance details

Defined in FRP.Yampa.Vector3

Methods

(==) :: Vector3 a -> Vector3 a -> Bool #

(/=) :: Vector3 a -> Vector3 a -> Bool #

(RealFloat a, Show a) => Show (Vector3 a) Source # 
Instance details

Defined in FRP.Yampa.Vector3

Methods

showsPrec :: Int -> Vector3 a -> ShowS #

show :: Vector3 a -> String #

showList :: [Vector3 a] -> ShowS #

RealFloat a => VectorSpace (Vector3 a) a Source # 
Instance details

Defined in FRP.Yampa.Vector3

RealFloat a => AffineSpace (Point3 a) (Vector3 a) a Source # 
Instance details

Defined in FRP.Yampa.Point3

Methods

origin :: Point3 a Source #

(.+^) :: Point3 a -> Vector3 a -> Point3 a Source #

(.-^) :: Point3 a -> Vector3 a -> Point3 a Source #

(.-.) :: Point3 a -> Point3 a -> Vector3 a Source #

distance :: Point3 a -> Point3 a -> a Source #

vector3 :: RealFloat a => a -> a -> a -> Vector3 a Source #

vector3XYZ :: RealFloat a => Vector3 a -> (a, a, a) Source #

vector3Spherical :: RealFloat a => a -> a -> a -> Vector3 a Source #

vector3Rotate :: RealFloat a => a -> a -> Vector3 a -> Vector3 a Source #

data RealFloat a => Vector2 a Source #

Instances
RealFloat a => Eq (Vector2 a) Source # 
Instance details

Defined in FRP.Yampa.Vector2

Methods

(==) :: Vector2 a -> Vector2 a -> Bool #

(/=) :: Vector2 a -> Vector2 a -> Bool #

(RealFloat a, Show a) => Show (Vector2 a) Source # 
Instance details

Defined in FRP.Yampa.Vector2

Methods

showsPrec :: Int -> Vector2 a -> ShowS #

show :: Vector2 a -> String #

showList :: [Vector2 a] -> ShowS #

RealFloat a => VectorSpace (Vector2 a) a Source # 
Instance details

Defined in FRP.Yampa.Vector2

RealFloat a => AffineSpace (Point2 a) (Vector2 a) a Source # 
Instance details

Defined in FRP.Yampa.Point2

Methods

origin :: Point2 a Source #

(.+^) :: Point2 a -> Vector2 a -> Point2 a Source #

(.-^) :: Point2 a -> Vector2 a -> Point2 a Source #

(.-.) :: Point2 a -> Point2 a -> Vector2 a Source #

distance :: Point2 a -> Point2 a -> a Source #

vector2 :: RealFloat a => a -> a -> Vector2 a Source #

vector2XY :: RealFloat a => Vector2 a -> (a, a) Source #

vector2Polar :: RealFloat a => a -> a -> Vector2 a Source #

class (Floating a, VectorSpace v a) => AffineSpace p v a | p -> v, v -> a where Source #

Minimal complete definition

origin, (.+^), (.-.)

Methods

origin :: p Source #

(.+^) :: p -> v -> p infix 6 Source #

(.-^) :: p -> v -> p infix 6 Source #

(.-.) :: p -> p -> v infix 6 Source #

distance :: p -> p -> a Source #

Instances
RealFloat a => AffineSpace (Point3 a) (Vector3 a) a Source # 
Instance details

Defined in FRP.Yampa.Point3

Methods

origin :: Point3 a Source #

(.+^) :: Point3 a -> Vector3 a -> Point3 a Source #

(.-^) :: Point3 a -> Vector3 a -> Point3 a Source #

(.-.) :: Point3 a -> Point3 a -> Vector3 a Source #

distance :: Point3 a -> Point3 a -> a Source #

RealFloat a => AffineSpace (Point2 a) (Vector2 a) a Source # 
Instance details

Defined in FRP.Yampa.Point2

Methods

origin :: Point2 a Source #

(.+^) :: Point2 a -> Vector2 a -> Point2 a Source #

(.-^) :: Point2 a -> Vector2 a -> Point2 a Source #

(.-.) :: Point2 a -> Point2 a -> Vector2 a Source #

distance :: Point2 a -> Point2 a -> a Source #

data RealFloat a => Point3 a Source #

Constructors

Point3 !a !a !a 
Instances
RealFloat a => Eq (Point3 a) Source # 
Instance details

Defined in FRP.Yampa.Point3

Methods

(==) :: Point3 a -> Point3 a -> Bool #

(/=) :: Point3 a -> Point3 a -> Bool #

RealFloat a => AffineSpace (Point3 a) (Vector3 a) a Source # 
Instance details

Defined in FRP.Yampa.Point3

Methods

origin :: Point3 a Source #

(.+^) :: Point3 a -> Vector3 a -> Point3 a Source #

(.-^) :: Point3 a -> Vector3 a -> Point3 a Source #

(.-.) :: Point3 a -> Point3 a -> Vector3 a Source #

distance :: Point3 a -> Point3 a -> a Source #

data RealFloat a => Point2 a Source #

Constructors

Point2 !a !a 
Instances
RealFloat a => Eq (Point2 a) Source # 
Instance details

Defined in FRP.Yampa.Point2

Methods

(==) :: Point2 a -> Point2 a -> Bool #

(/=) :: Point2 a -> Point2 a -> Bool #

(RealFloat a, Show a) => Show (Point2 a) Source # 
Instance details

Defined in FRP.Yampa.Point2

Methods

showsPrec :: Int -> Point2 a -> ShowS #

show :: Point2 a -> String #

showList :: [Point2 a] -> ShowS #

RealFloat a => AffineSpace (Point2 a) (Vector2 a) a Source # 
Instance details

Defined in FRP.Yampa.Point2

Methods

origin :: Point2 a Source #

(.+^) :: Point2 a -> Vector2 a -> Point2 a Source #

(.-^) :: Point2 a -> Vector2 a -> Point2 a Source #

(.-.) :: Point2 a -> Point2 a -> Vector2 a Source #

distance :: Point2 a -> Point2 a -> a Source #

data Event a Source #

Constructors

Event a 
NoEvent 
Instances
Functor Event Source # 
Instance details

Defined in FRP.BearRiver

Methods

fmap :: (a -> b) -> Event a -> Event b #

(<$) :: a -> Event b -> Event a #

Applicative Event Source # 
Instance details

Defined in FRP.BearRiver

Methods

pure :: a -> Event a #

(<*>) :: Event (a -> b) -> Event a -> Event b #

liftA2 :: (a -> b -> c) -> Event a -> Event b -> Event c #

(*>) :: Event a -> Event b -> Event b #

(<*) :: Event a -> Event b -> Event a #

Eq a => Eq (Event a) Source # 
Instance details

Defined in FRP.BearRiver

Methods

(==) :: Event a -> Event a -> Bool #

(/=) :: Event a -> Event a -> Bool #

Show a => Show (Event a) Source # 
Instance details

Defined in FRP.BearRiver

Methods

showsPrec :: Int -> Event a -> ShowS #

show :: Event a -> String #

showList :: [Event a] -> ShowS #

arrPrim :: Monad m => (a -> b) -> SF m a b Source #

arrEPrim :: Monad m => (Event a -> b) -> SF m (Event a) b Source #

identity :: Monad m => SF m a a Source #

constant :: Monad m => b -> SF m a b Source #

time :: Monad m => SF m a Time Source #

(-->) :: Monad m => b -> SF m a b -> SF m a b infixr 0 Source #

Initialization operator (cf. Lustre/Lucid Synchrone).

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

(-:>) :: Monad m => b -> SF m a b -> SF m a b infixr 0 Source #

Output pre-insert operator.

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

(>--) :: Monad m => a -> SF m a b -> SF m a b infixr 0 Source #

Input initialization operator.

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

(>=-) :: Monad m => (a -> a) -> SF m a b -> SF m a b infixr 0 Source #

initially :: Monad m => a -> SF m a a Source #

sscan :: Monad m => (b -> a -> b) -> b -> SF m a b Source #

sscanPrim :: Monad m => (c -> a -> Maybe (c, b)) -> c -> b -> SF m a b Source #

never :: Monad m => SF m a (Event b) Source #

Event source that never occurs.

now :: Monad m => b -> SF m a (Event b) Source #

Event source with a single occurrence at time 0. The value of the event is given by the function argument.

after Source #

Arguments

:: Monad m 
=> Time

The time q after which the event should be produced

-> b

Value to produce at that time

-> SF m a (Event b) 

repeatedly :: Monad m => Time -> b -> SF m a (Event b) Source #

afterEach :: Monad m => [(Time, b)] -> SF m a (Event b) Source #

Event source with consecutive occurrences at the given intervals. Should more than one event be scheduled to occur in any sampling interval, only the first will in fact occur to avoid an event backlog.

afterEachCat :: Monad m => [(Time, b)] -> SF m a (Event [b]) Source #

Event source with consecutive occurrences at the given intervals. Should more than one event be scheduled to occur in any sampling interval, the output list will contain all events produced during that interval.

mapEventS :: Monad m => MSF m a b -> MSF m (Event a) (Event b) Source #

Apply an MSF to every input. Freezes temporarily if the input is NoEvent, and continues as soon as an Event is received.

edge :: Monad m => SF m Bool (Event ()) Source #

iEdge :: Monad m => Bool -> SF m Bool (Event ()) Source #

edgeTag :: Monad m => a -> SF m Bool (Event a) Source #

Like edge, but parameterized on the tag value.

From Yampa

edgeJust :: Monad m => SF m (Maybe a) (Event a) Source #

Edge detector particularized for detecting transtitions on a Maybe signal from Nothing to Just.

From Yampa

edgeBy :: Monad m => (a -> a -> Maybe b) -> a -> SF m a (Event b) Source #

edgeFrom :: Monad m => Bool -> SF m Bool (Event ()) Source #

notYet :: Monad m => SF m (Event a) (Event a) Source #

Suppression of initial (at local time 0) event.

once :: Monad m => SF m (Event a) (Event a) Source #

Suppress all but the first event.

takeEvents :: Monad m => Int -> SF m (Event a) (Event a) Source #

Suppress all but the first n events.

dropEvents :: Monad m => Int -> SF m (Event a) (Event a) Source #

Suppress first n events.

noEventFst :: (Event a, b) -> (Event c, b) Source #

Suppress any event in the first component of a pair.

noEventSnd :: (a, Event b) -> (a, Event c) Source #

Suppress any event in the second component of a pair.

event :: a -> (b -> a) -> Event b -> a Source #

tag :: Event a -> b -> Event b Source #

tagWith :: b -> Event a -> Event b Source #

Tags an (occurring) event with a value ("replacing" the old value). Same as tag with the arguments swapped.

Applicative-based definition: tagWith = (<$)

attach :: Event a -> b -> Event (a, b) Source #

Attaches an extra value to the value of an occurring event.

lMerge :: Event a -> Event a -> Event a Source #

Left-biased event merge (always prefer left event, if present).

rMerge :: Event a -> Event a -> Event a Source #

Right-biased event merge (always prefer right event, if present).

merge :: Event a -> Event a -> Event a Source #

mergeBy :: (a -> a -> a) -> Event a -> Event a -> Event a Source #

mapMerge :: (a -> c) -> (b -> c) -> (a -> b -> c) -> Event a -> Event b -> Event c Source #

A generic event merge-map utility that maps event occurrences, merging the results. The first three arguments are mapping functions, the third of which will only be used when both events are present. Therefore, mergeBy = mapMerge id id

Applicative-based definition: mapMerge lf rf lrf le re = (f $ le * re) | (lf $ le) | (rf $ re)

mergeEvents :: [Event a] -> Event a Source #

Merge a list of events; foremost event has priority.

Foldable-based definition: mergeEvents :: Foldable t => t (Event a) -> Event a mergeEvents = asum

catEvents :: [Event a] -> Event [a] Source #

Collect simultaneous event occurrences; no event if none.

Traverable-based definition: catEvents :: Foldable t => t (Event a) -> Event (t a) carEvents e = if (null e) then NoEvent else (sequenceA e)

joinE :: Event a -> Event b -> Event (a, b) Source #

Join (conjunction) of two events. Only produces an event if both events exist.

Applicative-based definition: joinE = liftA2 (,)

splitE :: Event (a, b) -> (Event a, Event b) Source #

Split event carrying pairs into two events.

filterE :: (a -> Bool) -> Event a -> Event a Source #

Filter out events that don't satisfy some predicate.

mapFilterE :: (a -> Maybe b) -> Event a -> Event b Source #

Combined event mapping and filtering. Note: since Event is a Functor, see fmap for a simpler version of this function with no filtering.

gate :: Event a -> Bool -> Event a Source #

Enable/disable event occurences based on an external condition.

switch :: Monad m => SF m a (b, Event c) -> (c -> SF m a b) -> SF m a b Source #

dSwitch :: Monad m => SF m a (b, Event c) -> (c -> SF m a b) -> SF m a b Source #

parB :: Monad m => [SF m a b] -> SF m a [b] Source #

dpSwitchB :: (Monad m, Traversable col) => col (SF m a b) -> SF m (a, col b) (Event c) -> (col (SF m a b) -> c -> SF m a (col b)) -> SF m a (col b) Source #

parC :: Monad m => SF m a b -> SF m [a] [b] Source #

parC' :: Monad m => [SF m a b] -> SF m [a] [b] Source #

hold :: Monad m => a -> SF m (Event a) a Source #

accumBy :: Monad m => (b -> a -> b) -> b -> SF m (Event a) (Event b) Source #

Accumulator parameterized by the accumulation function.

accumHoldBy :: Monad m => (b -> a -> b) -> b -> SF m (Event a) b Source #

loopPre :: Monad m => c -> SF m (a, c) (b, c) -> SF m a b Source #

integral :: (Monad m, VectorSpace a s) => SF m a a Source #

integralFrom :: (Monad m, VectorSpace a s) => a -> SF m a a Source #

derivative :: (Monad m, VectorSpace a s) => SF m a a Source #

derivativeFrom :: (Monad m, VectorSpace a s) => a -> SF m a a Source #

iterFrom :: Monad m => (a -> a -> DTime -> b -> b) -> b -> SF m a b Source #

occasionally Source #

Arguments

:: MonadRandom m 
=> Time

The time q after which the event should be produced on average

-> b

Value to produce at time of event

-> SF m a (Event b) 

reactimate :: Monad m => m a -> (Bool -> m (DTime, Maybe a)) -> (Bool -> b -> m Bool) -> SF Identity a b -> m () Source #

evalAtZero :: SF Identity a b -> a -> (b, SF Identity a b) Source #

Evaluate an SF, and return an output and an initialized SF.

WARN: Do not use this function for standard simulation. This function is intended only for debugging/testing. Apart from being potentially slower and consuming more memory, it also breaks the FRP abstraction by making samples discrete and step based.

evalAt :: SF Identity a b -> DTime -> a -> (b, SF Identity a b) Source #

Evaluate an initialized SF, and return an output and a continuation.

WARN: Do not use this function for standard simulation. This function is intended only for debugging/testing. Apart from being potentially slower and consuming more memory, it also breaks the FRP abstraction by making samples discrete and step based.

evalFuture :: SF Identity a b -> a -> DTime -> (b, SF Identity a b) Source #

Given a signal function and time delta, it moves the signal function into the future, returning a new uninitialized SF and the initial output.

While the input sample refers to the present, the time delta refers to the future (or to the time between the current sample and the next sample).

WARN: Do not use this function for standard simulation. This function is intended only for debugging/testing. Apart from being potentially slower and consuming more memory, it also breaks the FRP abstraction by making samples discrete and step based.

replaceOnce :: Monad m => a -> SF m a a Source #

dup :: b -> (b, b) Source #