dunai-0.2.0.0: Generalised reactive framework supporting classic, arrowized and monadic FRP.

Safe HaskellSafe
LanguageHaskell2010

Data.MonadicStreamFunction.Util

Contents

Synopsis

Useful aliases

type MStream m a = MSF m () a Source #

type MSink m a = MSF m a () Source #

Stateful accumulation

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

Accumulation for monoids

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

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

Accumulation for VectorSpace instances

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

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

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

Generating Signals

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

repeatedly :: Monad m => (a -> a) -> a -> MSF m () a Source #

Analogues of map and fmap

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

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

Adding side effects

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

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

Debugging

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

trace :: Show a => String -> MSF IO a a Source #

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

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

Inserting monadic actions into MSFs

insert :: Monad m => MSF m (m a) a Source #

Deprecated: Don't use this. arrM id instead

arrM_ :: Monad m => m b -> MSF m a b Source #

Lifting from one monad into another

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

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

Delays and signal overwriting

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

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

Alternative running functions

embed_ :: (Functor m, Monad m) => MSF m a () -> [a] -> m () Source #

Run an MSF fed from a list, discarding results. Useful when one needs to combine effects and streams (i.e., for testing purposes).