rhine-1.5: Functional Reactive Programming with type-level clocks
Safe HaskellSafe-Inferred
LanguageHaskell2010

FRP.Rhine.ResamplingBuffer

Description

This module introduces ResamplingBuffers, which are primitives that consume and produce data at different rates. Just as schedules form the boundaries between different clocks, (resampling) buffers form the boundaries between synchronous signal functions ticking at different speeds.

Synopsis

Documentation

data ResamplingBuffer m cla clb a b Source #

A stateful buffer from which one may get a value, or to which one may put a value, depending on the clocks. ResamplingBuffers can be clock-polymorphic, or specific to certain clocks.

  • m: Monad in which the ResamplingBuffer may have side effects
  • cla: The clock at which data enters the buffer
  • clb: The clock at which data leaves the buffer
  • a: The input type
  • b: The output type

Constructors

forall s. ResamplingBuffer 

Fields

  • buffer :: s

    The internal state of the buffer.

  • put :: TimeInfo cla -> a -> s -> m s

    Store one input value of type a at a given time stamp, and return an updated state.

  • get :: TimeInfo clb -> s -> m (Result s b)

    Retrieve one output value of type b at a given time stamp, and an updated state.

Instances

Instances details
Functor m => Profunctor (ResamplingBuffer m cla clb) Source # 
Instance details

Defined in FRP.Rhine.ResamplingBuffer

Methods

dimap :: (a -> b) -> (c -> d) -> ResamplingBuffer m cla clb b c -> ResamplingBuffer m cla clb a d #

lmap :: (a -> b) -> ResamplingBuffer m cla clb b c -> ResamplingBuffer m cla clb a c #

rmap :: (b -> c) -> ResamplingBuffer m cla clb a b -> ResamplingBuffer m cla clb a c #

(#.) :: forall a b c q. Coercible c b => q b c -> ResamplingBuffer m cla clb a b -> ResamplingBuffer m cla clb a c #

(.#) :: forall a b c q. Coercible b a => ResamplingBuffer m cla clb b c -> q a b -> ResamplingBuffer m cla clb a c #

Functor m => Functor (ResamplingBuffer m cla clb a) Source # 
Instance details

Defined in FRP.Rhine.ResamplingBuffer

Methods

fmap :: (a0 -> b) -> ResamplingBuffer m cla clb a a0 -> ResamplingBuffer m cla clb a b #

(<$) :: a0 -> ResamplingBuffer m cla clb a b -> ResamplingBuffer m cla clb a a0 #

type ResBuf m cla clb a b = ResamplingBuffer m cla clb a b Source #

A type synonym to allow for abbreviation.

hoistResamplingBuffer :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> ResamplingBuffer m1 cla clb a b -> ResamplingBuffer m2 cla clb a b Source #

Hoist a ResamplingBuffer along a monad morphism.