{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
module FRP.Rhine.ResamplingBuffer
( module FRP.Rhine.ResamplingBuffer
, module FRP.Rhine.Clock
)
where
import FRP.Rhine.Clock
data ResamplingBuffer m cla clb a b = ResamplingBuffer
{ ResamplingBuffer m cla clb a b
-> TimeInfo cla -> a -> m (ResamplingBuffer m cla clb a b)
put
:: TimeInfo cla
-> a
-> m ( ResamplingBuffer m cla clb a b)
, ResamplingBuffer m cla clb a b
-> TimeInfo clb -> m (b, ResamplingBuffer m cla clb a b)
get
:: TimeInfo clb
-> m (b, ResamplingBuffer m cla clb a b)
}
type ResBuf m cla clb a b = ResamplingBuffer m cla clb a b
hoistResamplingBuffer
:: (Monad m1, Monad m2)
=> (forall c. m1 c -> m2 c)
-> ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b
hoistResamplingBuffer :: (forall c. m1 c -> m2 c)
-> ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b
hoistResamplingBuffer forall c. m1 c -> m2 c
hoist ResamplingBuffer {TimeInfo cla -> a -> m1 (ResamplingBuffer m1 cla clb a b)
TimeInfo clb -> m1 (b, ResamplingBuffer m1 cla clb a b)
get :: TimeInfo clb -> m1 (b, ResamplingBuffer m1 cla clb a b)
put :: TimeInfo cla -> a -> m1 (ResamplingBuffer m1 cla clb a b)
get :: forall (m :: Type -> Type) cla clb a b.
ResamplingBuffer m cla clb a b
-> TimeInfo clb -> m (b, ResamplingBuffer m cla clb a b)
put :: forall (m :: Type -> Type) cla clb a b.
ResamplingBuffer m cla clb a b
-> TimeInfo cla -> a -> m (ResamplingBuffer m cla clb a b)
..} = ResamplingBuffer :: forall (m :: Type -> Type) cla clb a b.
(TimeInfo cla -> a -> m (ResamplingBuffer m cla clb a b))
-> (TimeInfo clb -> m (b, ResamplingBuffer m cla clb a b))
-> ResamplingBuffer m cla clb a b
ResamplingBuffer
{ put :: TimeInfo cla -> a -> m2 (ResamplingBuffer m2 cla clb a b)
put = ((((forall c. m1 c -> m2 c)
-> ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b
forall (m1 :: Type -> Type) (m2 :: Type -> Type) cla clb a b.
(Monad m1, Monad m2) =>
(forall c. m1 c -> m2 c)
-> ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b
hoistResamplingBuffer forall c. m1 c -> m2 c
hoist (ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b)
-> m2 (ResamplingBuffer m1 cla clb a b)
-> m2 (ResamplingBuffer m2 cla clb a b)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$>) (m2 (ResamplingBuffer m1 cla clb a b)
-> m2 (ResamplingBuffer m2 cla clb a b))
-> (m1 (ResamplingBuffer m1 cla clb a b)
-> m2 (ResamplingBuffer m1 cla clb a b))
-> m1 (ResamplingBuffer m1 cla clb a b)
-> m2 (ResamplingBuffer m2 cla clb a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m1 (ResamplingBuffer m1 cla clb a b)
-> m2 (ResamplingBuffer m1 cla clb a b)
forall c. m1 c -> m2 c
hoist) (m1 (ResamplingBuffer m1 cla clb a b)
-> m2 (ResamplingBuffer m2 cla clb a b))
-> (a -> m1 (ResamplingBuffer m1 cla clb a b))
-> a
-> m2 (ResamplingBuffer m2 cla clb a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.) ((a -> m1 (ResamplingBuffer m1 cla clb a b))
-> a -> m2 (ResamplingBuffer m2 cla clb a b))
-> (TimeInfo cla -> a -> m1 (ResamplingBuffer m1 cla clb a b))
-> TimeInfo cla
-> a
-> m2 (ResamplingBuffer m2 cla clb a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeInfo cla -> a -> m1 (ResamplingBuffer m1 cla clb a b)
put
, get :: TimeInfo clb -> m2 (b, ResamplingBuffer m2 cla clb a b)
get = ((ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b)
-> (b, ResamplingBuffer m1 cla clb a b)
-> (b, ResamplingBuffer m2 cla clb a b)
forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second ((forall c. m1 c -> m2 c)
-> ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b
forall (m1 :: Type -> Type) (m2 :: Type -> Type) cla clb a b.
(Monad m1, Monad m2) =>
(forall c. m1 c -> m2 c)
-> ResamplingBuffer m1 cla clb a b
-> ResamplingBuffer m2 cla clb a b
hoistResamplingBuffer forall c. m1 c -> m2 c
hoist) ((b, ResamplingBuffer m1 cla clb a b)
-> (b, ResamplingBuffer m2 cla clb a b))
-> m2 (b, ResamplingBuffer m1 cla clb a b)
-> m2 (b, ResamplingBuffer m2 cla clb a b)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$>) (m2 (b, ResamplingBuffer m1 cla clb a b)
-> m2 (b, ResamplingBuffer m2 cla clb a b))
-> (TimeInfo clb -> m2 (b, ResamplingBuffer m1 cla clb a b))
-> TimeInfo clb
-> m2 (b, ResamplingBuffer m2 cla clb a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m1 (b, ResamplingBuffer m1 cla clb a b)
-> m2 (b, ResamplingBuffer m1 cla clb a b)
forall c. m1 c -> m2 c
hoist (m1 (b, ResamplingBuffer m1 cla clb a b)
-> m2 (b, ResamplingBuffer m1 cla clb a b))
-> (TimeInfo clb -> m1 (b, ResamplingBuffer m1 cla clb a b))
-> TimeInfo clb
-> m2 (b, ResamplingBuffer m1 cla clb a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeInfo clb -> m1 (b, ResamplingBuffer m1 cla clb a b)
get
}