FRP.Behavior
- Package
- purescript-behaviors
- Repository
- paf31/purescript-behaviors
#Behavior Source
newtype Behavior a
A Behavior
acts like a continuous function of time.
We can construct a sample a Behavior
from some Event
, combine Behavior
s
using Applicative
, and sample a final Behavior
on some other Event
.
Instances
#integral Source
integral :: forall t a. Field t => Semiring a => (((a -> t) -> t) -> a) -> a -> Behavior t -> Behavior a -> Behavior a
Integrate with respect to some measure of time.
This function approximates the integral using the trapezium rule at the implicit sampling interval.
The Semiring
a
should be a vector field over the field t
. To represent
this, the user should provide a grate which lifts a multiplication
function on t
to a function on a
. Simple examples where t ~ a
can use
the integral'
function instead.
#derivative Source
derivative :: forall t a. Field t => Ring a => (((a -> t) -> t) -> a) -> Behavior t -> Behavior a -> Behavior a
Differentiate with respect to some measure of time.
This function approximates the derivative using a quotient of differences at the implicit sampling interval.
The Semiring
a
should be a vector field over the field t
. To represent
this, the user should provide a grate which lifts a division
function on t
to a function on a
. Simple examples where t ~ a
can use
the derivative'
function.