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

FRP.Rhine

Description

This module reexports most common names and combinators you will need to work with Rhine. It also exports most specific clocks and resampling buffers, so you can import everything in one line:

import FRP.Rhine

main :: IO ()
main = flow $ constMCl (putStrLn "Hello World!") @@ (waitClock :: Millisecond 100)
Synopsis

Documentation

class Monad m => MonadIO (m :: Type -> Type) where #

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Methods

liftIO :: IO a -> m a #

Lift a computation from the IO monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. IO is the base monad for the stack).

Example

Expand
import Control.Monad.Trans.State -- from the "transformers" library

printState :: Show s => StateT s IO ()
printState = do
  state <- get
  liftIO $ print state

Had we omitted liftIO, we would have ended up with this error:

• Couldn't match type ‘IO’ with ‘StateT s IO’
 Expected type: StateT s IO ()
   Actual type: IO ()

The important part here is the mismatch between StateT s IO () and IO ().

Luckily, we know of a function that takes an IO a and returns an (m a): liftIO, enabling us to run the program and see the expected results:

> evalStateT printState "hello"
"hello"

> evalStateT printState 3
3

Instances

Instances details
MonadIO IO

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.IO.Class

Methods

liftIO :: IO a -> IO a #

MonadIO Q 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftIO :: IO a -> Q a #

MonadIO m => MonadIO (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftIO :: IO a -> MaybeT m a #

MonadIO m => MonadIO (RandT g m) 
Instance details

Defined in Control.Monad.Trans.Random.Lazy

Methods

liftIO :: IO a -> RandT g m a #

MonadIO m => MonadIO (RandT g m) 
Instance details

Defined in Control.Monad.Trans.Random.Strict

Methods

liftIO :: IO a -> RandT g m a #

(Functor f, MonadIO m) => MonadIO (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftIO :: IO a -> FreeT f m a #

(Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

liftIO :: IO a -> AccumT w m a #

MonadIO m => MonadIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a #

MonadIO m => MonadIO (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftIO :: IO a -> IdentityT m a #

MonadIO m => MonadIO (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

liftIO :: IO a -> ReaderT r m a #

MonadIO m => MonadIO (SelectT r m) 
Instance details

Defined in Control.Monad.Trans.Select

Methods

liftIO :: IO a -> SelectT r m a #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

liftIO :: IO a -> StateT s m a #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

liftIO :: IO a -> StateT s m a #

MonadIO m => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftIO :: IO a -> WriterT w m a #

MonadIO m => MonadIO (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

liftIO :: IO a -> ContT r m a #

MonadIO m => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.CPS

Methods

liftIO :: IO a -> RWST r w s m a #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

liftIO :: IO a -> RWST r w s m a #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

liftIO :: IO a -> RWST r w s m a #

newtype ExceptT e (m :: Type -> Type) a #

A monad transformer that adds exceptions to other monads.

ExceptT constructs a monad parameterized over two things:

  • e - The exception type.
  • m - The inner monad.

The return function yields a computation that produces the given value, while >>= sequences two subcomputations, exiting on the first exception.

Constructors

ExceptT (m (Either e a)) 

Instances

Instances details
MonadSplit g m => MonadSplit g (ExceptT e m) 
Instance details

Defined in Control.Monad.Random.Class

Methods

getSplit :: ExceptT e m g #

Functor m => Generic1 (ExceptT e m :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Except

Associated Types

type Rep1 (ExceptT e m) :: k -> Type #

Methods

from1 :: forall (a :: k). ExceptT e m a -> Rep1 (ExceptT e m) a #

to1 :: forall (a :: k). Rep1 (ExceptT e m) a -> ExceptT e m a #

Monad m => MonadError e (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> ExceptT e m a #

catchError :: ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a #

MonadTrans (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

lift :: Monad m => m a -> ExceptT e m a #

MonadInterleave m => MonadInterleave (ExceptT e m) 
Instance details

Defined in Control.Monad.Random.Class

Methods

interleave :: ExceptT e m a -> ExceptT e m a #

MonadRandom m => MonadRandom (ExceptT e m) 
Instance details

Defined in Control.Monad.Random.Class

Methods

getRandomR :: Random a => (a, a) -> ExceptT e m a #

getRandom :: Random a => ExceptT e m a #

getRandomRs :: Random a => (a, a) -> ExceptT e m [a] #

getRandoms :: Random a => ExceptT e m [a] #

MonadFail m => MonadFail (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fail :: String -> ExceptT e m a #

MonadFix m => MonadFix (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mfix :: (a -> ExceptT e m a) -> ExceptT e m a #

MonadIO m => MonadIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a #

MonadZip m => MonadZip (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzip :: ExceptT e m a -> ExceptT e m b -> ExceptT e m (a, b) #

mzipWith :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

munzip :: ExceptT e m (a, b) -> (ExceptT e m a, ExceptT e m b) #

Foldable f => Foldable (ExceptT e f) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fold :: Monoid m => ExceptT e f m -> m #

foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m #

foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m #

foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b #

foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b #

foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b #

foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b #

foldr1 :: (a -> a -> a) -> ExceptT e f a -> a #

foldl1 :: (a -> a -> a) -> ExceptT e f a -> a #

toList :: ExceptT e f a -> [a] #

null :: ExceptT e f a -> Bool #

length :: ExceptT e f a -> Int #

elem :: Eq a => a -> ExceptT e f a -> Bool #

maximum :: Ord a => ExceptT e f a -> a #

minimum :: Ord a => ExceptT e f a -> a #

sum :: Num a => ExceptT e f a -> a #

product :: Num a => ExceptT e f a -> a #

(Eq e, Eq1 m) => Eq1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftEq :: (a -> b -> Bool) -> ExceptT e m a -> ExceptT e m b -> Bool #

(Ord e, Ord1 m) => Ord1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftCompare :: (a -> b -> Ordering) -> ExceptT e m a -> ExceptT e m b -> Ordering #

(Read e, Read1 m) => Read1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ExceptT e m a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e m a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e m a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e m a] #

(Show e, Show1 m) => Show1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ExceptT e m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ExceptT e m a] -> ShowS #

Contravariant m => Contravariant (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

contramap :: (a' -> a) -> ExceptT e m a -> ExceptT e m a' #

(>$) :: b -> ExceptT e m b -> ExceptT e m a #

Traversable f => Traversable (ExceptT e f) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

traverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) #

sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) #

mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) #

sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) #

(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

empty :: ExceptT e m a #

(<|>) :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

some :: ExceptT e m a -> ExceptT e m [a] #

many :: ExceptT e m a -> ExceptT e m [a] #

(Functor m, Monad m) => Applicative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

pure :: a -> ExceptT e m a #

(<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b #

liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

(*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b #

(<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a #

Functor m => Functor (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fmap :: (a -> b) -> ExceptT e m a -> ExceptT e m b #

(<$) :: a -> ExceptT e m b -> ExceptT e m a #

Monad m => Monad (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

(>>=) :: ExceptT e m a -> (a -> ExceptT e m b) -> ExceptT e m b #

(>>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b #

return :: a -> ExceptT e m a #

(Monad m, Monoid e) => MonadPlus (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzero :: ExceptT e m a #

mplus :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

(Monad m, MonadSchedule m) => MonadSchedule (ExceptT e m)

Schedule all actions according to m and in case of exceptions throw the first exception of the immediately returning actions.

Instance details

Defined in Control.Monad.Schedule.Class

Methods

schedule :: NonEmpty (ExceptT e m a) -> ExceptT e m (NonEmpty a, [ExceptT e m a]) #

PrimMonad m => PrimMonad (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ExceptT e m) #

Methods

primitive :: (State# (PrimState (ExceptT e m)) -> (# State# (PrimState (ExceptT e m)), a #)) -> ExceptT e m a #

Generic (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Associated Types

type Rep (ExceptT e m a) :: Type -> Type #

Methods

from :: ExceptT e m a -> Rep (ExceptT e m a) x #

to :: Rep (ExceptT e m a) x -> ExceptT e m a #

(Read e, Read1 m, Read a) => Read (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

readsPrec :: Int -> ReadS (ExceptT e m a) #

readList :: ReadS [ExceptT e m a] #

readPrec :: ReadPrec (ExceptT e m a) #

readListPrec :: ReadPrec [ExceptT e m a] #

(Show e, Show1 m, Show a) => Show (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

showsPrec :: Int -> ExceptT e m a -> ShowS #

show :: ExceptT e m a -> String #

showList :: [ExceptT e m a] -> ShowS #

(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

(==) :: ExceptT e m a -> ExceptT e m a -> Bool #

(/=) :: ExceptT e m a -> ExceptT e m a -> Bool #

(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

compare :: ExceptT e m a -> ExceptT e m a -> Ordering #

(<) :: ExceptT e m a -> ExceptT e m a -> Bool #

(<=) :: ExceptT e m a -> ExceptT e m a -> Bool #

(>) :: ExceptT e m a -> ExceptT e m a -> Bool #

(>=) :: ExceptT e m a -> ExceptT e m a -> Bool #

max :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

min :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

type Rep1 (ExceptT e m :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Except

type Rep1 (ExceptT e m :: Type -> Type) = D1 ('MetaData "ExceptT" "Control.Monad.Trans.Except" "transformers-0.6.1.0" 'True) (C1 ('MetaCons "ExceptT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 (Either e))))
type PrimState (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

type PrimState (ExceptT e m) = PrimState m
type Rep (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

type Rep (ExceptT e m a) = D1 ('MetaData "ExceptT" "Control.Monad.Trans.Except" "transformers-0.6.1.0" 'True) (C1 ('MetaCons "ExceptT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Either e a)))))

data Result s a #

A tuple that is strict in its first argument.

This type is used in streams and automata to encode the result of a state transition. The new state should always be strict to avoid space leaks.

Constructors

Result 

Fields

Instances

Instances details
Bifunctor Result 
Instance details

Defined in Data.Stream.Result

Methods

bimap :: (a -> b) -> (c -> d) -> Result a c -> Result b d #

first :: (a -> b) -> Result a c -> Result b c #

second :: (b -> c) -> Result a b -> Result a c #

Functor (Result s) 
Instance details

Defined in Data.Stream.Result

Methods

fmap :: (a -> b) -> Result s a -> Result s b #

(<$) :: a -> Result s b -> Result s a #

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

An effectful automaton in initial encoding.

  • m: The monad in which the automaton performs side effects.
  • a: The type of inputs the automaton constantly consumes.
  • b: The type of outputs the automaton constantly produces.

An effectful automaton with input a is the same as an effectful stream with the additional effect of reading an input value a on every step. This is why automata are defined here as streams.

The API of automata follows that of streams (StreamT and OptimizedStreamT) closely. The prominent addition in automata is now that they are instances of the Category, Arrow, Profunctor, and related type classes. This allows for more ways of creating or composing them.

For example, you can sequentially and parallely compose two automata: @ automaton1 :: Automaton m a b automaton2 :: Automaton m b c

sequentially :: Automaton m a c sequentially = automaton1 >>> automaton2

parallely :: Automaton m (a, b) (b, c) parallely = automaton1 *** automaton2 @ In sequential composition, the output of the first automaton is passed as input to the second one. In parallel composition, both automata receive input simulataneously and process it independently.

Through the Arrow type class, you can use arr to create an automaton from a pure function, and more generally use the arrow syntax extension to define automata.

Constructors

Automaton 

Instances

Instances details
Monad m => Category (Automaton m :: Type -> Type -> Type) 
Instance details

Defined in Data.Automaton

Methods

id :: forall (a :: k). Automaton m a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Automaton m b c -> Automaton m a b -> Automaton m a c #

Monad m => Arrow (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

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

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

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

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

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

Monad m => ArrowChoice (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

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

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

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

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

MonadFix m => ArrowLoop (Automaton m)

Caution, this can make your program hang. Try to use feedback or unfold where possible, or combine loop with delay.

Instance details

Defined in Data.Automaton

Methods

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

(Monad m, Alternative m) => ArrowPlus (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

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

(Monad m, Alternative m) => ArrowZero (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

zeroArrow :: Automaton m b c #

Monad m => Choice (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

left' :: Automaton m a b -> Automaton m (Either a c) (Either b c) #

right' :: Automaton m a b -> Automaton m (Either c a) (Either c b) #

Monad m => Strong (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

first' :: Automaton m a b -> Automaton m (a, c) (b, c) #

second' :: Automaton m a b -> Automaton m (c, a) (c, b) #

Monad m => Traversing (Automaton m)

Step an automaton several steps at once, depending on how long the input is.

Instance details

Defined in Data.Automaton

Methods

traverse' :: Traversable f => Automaton m a b -> Automaton m (f a) (f b) #

wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> Automaton m a b -> Automaton m s t #

Monad m => Profunctor (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

dimap :: (a -> b) -> (c -> d) -> Automaton m b c -> Automaton m a d #

lmap :: (a -> b) -> Automaton m b c -> Automaton m a c #

rmap :: (b -> c) -> Automaton m a b -> Automaton m a c #

(#.) :: forall a b c q. Coercible c b => q b c -> Automaton m a b -> Automaton m a c #

(.#) :: forall a b c q. Coercible b a => Automaton m b c -> q a b -> Automaton m a c #

Alternative m => Alternative (Automaton m a) 
Instance details

Defined in Data.Automaton

Methods

empty :: Automaton m a a0 #

(<|>) :: Automaton m a a0 -> Automaton m a a0 -> Automaton m a a0 #

some :: Automaton m a a0 -> Automaton m a [a0] #

many :: Automaton m a a0 -> Automaton m a [a0] #

Applicative m => Applicative (Automaton m a) 
Instance details

Defined in Data.Automaton

Methods

pure :: a0 -> Automaton m a a0 #

(<*>) :: Automaton m a (a0 -> b) -> Automaton m a a0 -> Automaton m a b #

liftA2 :: (a0 -> b -> c) -> Automaton m a a0 -> Automaton m a b -> Automaton m a c #

(*>) :: Automaton m a a0 -> Automaton m a b -> Automaton m a b #

(<*) :: Automaton m a a0 -> Automaton m a b -> Automaton m a a0 #

Functor m => Functor (Automaton m a) 
Instance details

Defined in Data.Automaton

Methods

fmap :: (a0 -> b) -> Automaton m a a0 -> Automaton m a b #

(<$) :: a0 -> Automaton m a b -> Automaton m a a0 #

Selective m => Selective (Automaton m a) 
Instance details

Defined in Data.Automaton

Methods

select :: Automaton m a (Either a0 b) -> Automaton m a (a0 -> b) -> Automaton m a b #

Align m => Align (Automaton m a) 
Instance details

Defined in Data.Automaton

Methods

nil :: Automaton m a a0 #

Semialign m => Semialign (Automaton m a) 
Instance details

Defined in Data.Automaton

Methods

align :: Automaton m a a0 -> Automaton m a b -> Automaton m a (These a0 b) #

alignWith :: (These a0 b -> c) -> Automaton m a a0 -> Automaton m a b -> Automaton m a c #

(Applicative m, Floating b) => Floating (Automaton m a b) 
Instance details

Defined in Data.Automaton

Methods

pi :: Automaton m a b #

exp :: Automaton m a b -> Automaton m a b #

log :: Automaton m a b -> Automaton m a b #

sqrt :: Automaton m a b -> Automaton m a b #

(**) :: Automaton m a b -> Automaton m a b -> Automaton m a b #

logBase :: Automaton m a b -> Automaton m a b -> Automaton m a b #

sin :: Automaton m a b -> Automaton m a b #

cos :: Automaton m a b -> Automaton m a b #

tan :: Automaton m a b -> Automaton m a b #

asin :: Automaton m a b -> Automaton m a b #

acos :: Automaton m a b -> Automaton m a b #

atan :: Automaton m a b -> Automaton m a b #

sinh :: Automaton m a b -> Automaton m a b #

cosh :: Automaton m a b -> Automaton m a b #

tanh :: Automaton m a b -> Automaton m a b #

asinh :: Automaton m a b -> Automaton m a b #

acosh :: Automaton m a b -> Automaton m a b #

atanh :: Automaton m a b -> Automaton m a b #

log1p :: Automaton m a b -> Automaton m a b #

expm1 :: Automaton m a b -> Automaton m a b #

log1pexp :: Automaton m a b -> Automaton m a b #

log1mexp :: Automaton m a b -> Automaton m a b #

(Applicative m, Num b) => Num (Automaton m a b) 
Instance details

Defined in Data.Automaton

Methods

(+) :: Automaton m a b -> Automaton m a b -> Automaton m a b #

(-) :: Automaton m a b -> Automaton m a b -> Automaton m a b #

(*) :: Automaton m a b -> Automaton m a b -> Automaton m a b #

negate :: Automaton m a b -> Automaton m a b #

abs :: Automaton m a b -> Automaton m a b #

signum :: Automaton m a b -> Automaton m a b #

fromInteger :: Integer -> Automaton m a b #

(Applicative m, Fractional b) => Fractional (Automaton m a b) 
Instance details

Defined in Data.Automaton

Methods

(/) :: Automaton m a b -> Automaton m a b -> Automaton m a b #

recip :: Automaton m a b -> Automaton m a b #

fromRational :: Rational -> Automaton m a b #

(Eq s, Floating s, VectorSpace v s, Applicative m) => VectorSpace (Automaton m a v) (Automaton m a s) 
Instance details

Defined in Data.Automaton

Methods

zeroVector :: Automaton m a v #

(*^) :: Automaton m a s -> Automaton m a v -> Automaton m a v #

(^/) :: Automaton m a v -> Automaton m a s -> Automaton m a v #

(^+^) :: Automaton m a v -> Automaton m a v -> Automaton m a v #

(^-^) :: Automaton m a v -> Automaton m a v -> Automaton m a v #

negateVector :: Automaton m a v -> Automaton m a v #

dot :: Automaton m a v -> Automaton m a v -> Automaton m a s #

norm :: Automaton m a v -> Automaton m a s #

normalize :: Automaton m a v -> Automaton m a v #

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

Instances details
Monad m => Arrow (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

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

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

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

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

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

Monad m => Arrow (Final m) 
Instance details

Defined in Data.Automaton.Final

Methods

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

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

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

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

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

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 (->)

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') #

(Arrow p, Arrow q) => Arrow (Product p q) 
Instance details

Defined in Data.Bifunctor.Product

Methods

arr :: (b -> c) -> Product p q b c #

first :: Product p q b c -> Product p q (b, d) (c, d) #

second :: Product p q b c -> Product p q (d, b) (d, c) #

(***) :: Product p q b c -> Product p q b' c' -> Product p q (b, b') (c, c') #

(&&&) :: Product p q b c -> Product p q b c' -> Product p q b (c, c') #

(Applicative f, Arrow p) => Arrow (Tannen f p) 
Instance details

Defined in Data.Bifunctor.Tannen

Methods

arr :: (b -> c) -> Tannen f p b c #

first :: Tannen f p b c -> Tannen f p (b, d) (c, d) #

second :: Tannen f p b c -> Tannen f p (d, b) (d, c) #

(***) :: Tannen f p b c -> Tannen f p b' c' -> Tannen f p (b, b') (c, c') #

(&&&) :: Tannen f p b c -> Tannen f p b c' -> Tannen f p b (c, c') #

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

Instances details
MonadFix m => ArrowLoop (Automaton m)

Caution, this can make your program hang. Try to use feedback or unfold where possible, or combine loop with delay.

Instance details

Defined in Data.Automaton

Methods

loop :: Automaton m (b, d) (c, d) -> Automaton m 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 #

ArrowLoop (->)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

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

(ArrowLoop p, ArrowLoop q) => ArrowLoop (Product p q) 
Instance details

Defined in Data.Bifunctor.Product

Methods

loop :: Product p q (b, d) (c, d) -> Product p q b c #

(Applicative f, ArrowLoop p) => ArrowLoop (Tannen f p) 
Instance details

Defined in Data.Bifunctor.Tannen

Methods

loop :: Tannen f p (b, d) (c, d) -> Tannen f p 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

Instances details
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] #

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 #

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 #

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 #

(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 #

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

Instances details
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 (->)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

app :: (b -> c, 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

Instances details
Monad m => ArrowChoice (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

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

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

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

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

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 (->)

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 #

(ArrowChoice p, ArrowChoice q) => ArrowChoice (Product p q) 
Instance details

Defined in Data.Bifunctor.Product

Methods

left :: Product p q b c -> Product p q (Either b d) (Either c d) #

right :: Product p q b c -> Product p q (Either d b) (Either d c) #

(+++) :: Product p q b c -> Product p q b' c' -> Product p q (Either b b') (Either c c') #

(|||) :: Product p q b d -> Product p q c d -> Product p q (Either b c) d #

(Applicative f, ArrowChoice p) => ArrowChoice (Tannen f p) 
Instance details

Defined in Data.Bifunctor.Tannen

Methods

left :: Tannen f p b c -> Tannen f p (Either b d) (Either c d) #

right :: Tannen f p b c -> Tannen f p (Either d b) (Either d c) #

(+++) :: Tannen f p b c -> Tannen f p b' c' -> Tannen f p (Either b b') (Either c c') #

(|||) :: Tannen f p b d -> Tannen f p c d -> Tannen f p (Either b c) d #

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

Instances details
(Monad m, Alternative m) => ArrowPlus (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

(<+>) :: Automaton m b c -> Automaton m b c -> Automaton 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 #

(ArrowPlus p, ArrowPlus q) => ArrowPlus (Product p q) 
Instance details

Defined in Data.Bifunctor.Product

Methods

(<+>) :: Product p q b c -> Product p q b c -> Product p q b c #

(Applicative f, ArrowPlus p) => ArrowPlus (Tannen f p) 
Instance details

Defined in Data.Bifunctor.Tannen

Methods

(<+>) :: Tannen f p b c -> Tannen f p b c -> Tannen f p b c #

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

Methods

zeroArrow :: a b c #

Instances

Instances details
(Monad m, Alternative m) => ArrowZero (Automaton m) 
Instance details

Defined in Data.Automaton

Methods

zeroArrow :: Automaton m b c #

MonadPlus m => ArrowZero (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

zeroArrow :: Kleisli m b c #

(ArrowZero p, ArrowZero q) => ArrowZero (Product p q) 
Instance details

Defined in Data.Bifunctor.Product

Methods

zeroArrow :: Product p q b c #

(Applicative f, ArrowZero p) => ArrowZero (Tannen f p) 
Instance details

Defined in Data.Bifunctor.Tannen

Methods

zeroArrow :: Tannen f p b c #

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

Kleisli arrows of a monad.

Constructors

Kleisli 

Fields

Instances

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

Since: base-3.0

Instance details

Defined in Control.Arrow

Methods

id :: forall (a :: k). Kleisli m a a #

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

Generic1 (Kleisli m a :: Type -> Type) 
Instance details

Defined in Control.Arrow

Associated Types

type Rep1 (Kleisli m a) :: k -> Type #

Methods

from1 :: forall (a0 :: k). Kleisli m a a0 -> Rep1 (Kleisli m a) a0 #

to1 :: forall (a0 :: k). Rep1 (Kleisli m a) a0 -> Kleisli m a a0 #

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') #

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 #

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 #

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 #

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 #

MonadPlus m => ArrowZero (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

zeroArrow :: Kleisli m b c #

Monad m => Profunctor (Kleisli m) 
Instance details

Defined in Data.Profunctor.Unsafe

Methods

dimap :: (a -> b) -> (c -> d) -> Kleisli m b c -> Kleisli m a d #

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

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

(#.) :: forall a b c q. Coercible c b => q b c -> Kleisli m a b -> Kleisli m a c #

(.#) :: forall a b c q. Coercible b a => Kleisli m b c -> q a b -> Kleisli m a c #

Alternative m => Alternative (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

empty :: Kleisli m a a0 #

(<|>) :: Kleisli m a a0 -> Kleisli m a a0 -> Kleisli m a a0 #

some :: Kleisli m a a0 -> Kleisli m a [a0] #

many :: Kleisli m a a0 -> Kleisli m a [a0] #

Applicative m => Applicative (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

pure :: a0 -> Kleisli m a a0 #

(<*>) :: Kleisli m a (a0 -> b) -> Kleisli m a a0 -> Kleisli m a b #

liftA2 :: (a0 -> b -> c) -> Kleisli m a a0 -> Kleisli m a b -> Kleisli m a c #

(*>) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a b #

(<*) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a a0 #

Functor m => Functor (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

fmap :: (a0 -> b) -> Kleisli m a a0 -> Kleisli m a b #

(<$) :: a0 -> Kleisli m a b -> Kleisli m a a0 #

Monad m => Monad (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

(>>=) :: Kleisli m a a0 -> (a0 -> Kleisli m a b) -> Kleisli m a b #

(>>) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a b #

return :: a0 -> Kleisli m a a0 #

MonadPlus m => MonadPlus (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

mzero :: Kleisli m a a0 #

mplus :: Kleisli m a a0 -> Kleisli m a a0 -> Kleisli m a a0 #

Generic (Kleisli m a b) 
Instance details

Defined in Control.Arrow

Associated Types

type Rep (Kleisli m a b) :: Type -> Type #

Methods

from :: Kleisli m a b -> Rep (Kleisli m a b) x #

to :: Rep (Kleisli m a b) x -> Kleisli m a b #

type Rep1 (Kleisli m a :: Type -> Type)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

type Rep1 (Kleisli m a :: Type -> Type) = D1 ('MetaData "Kleisli" "Control.Arrow" "base" 'True) (C1 ('MetaCons "Kleisli" 'PrefixI 'True) (S1 ('MetaSel ('Just "runKleisli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) ((FUN 'Many a :: Type -> Type) :.: Rec1 m)))
type Rep (Kleisli m a b)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

type Rep (Kleisli m a b) = D1 ('MetaData "Kleisli" "Control.Arrow" "base" 'True) (C1 ('MetaCons "Kleisli" 'PrefixI 'True) (S1 ('MetaSel ('Just "runKleisli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> m b))))

type family In cl where ... Source #

The clock that represents the rate at which data enters the system.

Equations

In (SequentialClock cl1 cl2) = In cl1 
In (ParallelClock cl1 cl2) = ParallelClock (In cl1) (In cl2) 
In cl = cl 

type Except e = ExceptT e Identity #

The parameterizable exception monad.

Computations are either exceptions or normal values.

The return function returns a normal value, while >>= exits on the first exception. For a variant that continues after an error and collects all the errors, see Errors.

class TimeDomain (Time cl) => Clock m cl where Source #

Since we want to leverage Haskell's type system to annotate signal networks by their clocks, each clock must be an own type, cl. Different values of the same clock type should tick at the same speed, and only differ in implementation details. Often, clocks are singletons.

Associated Types

type Time cl Source #

The time domain, i.e. type of the time stamps the clock creates.

type Tag cl Source #

Additional information that the clock may output at each tick, e.g. if a realtime promise was met, if an event occurred, if one of its subclocks (if any) ticked.

Methods

initClock Source #

Arguments

:: cl

The clock value, containing e.g. settings or device parameters

-> RunningClockInit m (Time cl) (Tag cl)

The stream of time stamps, and the initial time

The method that produces to a clock value a running clock, i.e. an effectful stream of tagged time stamps together with an initialisation time.

Instances

Instances details
MonadIO m => Clock m Busy Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Busy

Associated Types

type Time Busy Source #

type Tag Busy Source #

MonadIO m => Clock m Never Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Never

Associated Types

type Time Never Source #

type Tag Never Source #

MonadIO m => Clock m StdinClock Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Stdin

Associated Types

type Time StdinClock Source #

type Tag StdinClock Source #

Monad m => Clock m Trivial Source # 
Instance details

Defined in FRP.Rhine.Clock.Trivial

Associated Types

type Time Trivial Source #

type Tag Trivial Source #

Clock IO (Millisecond n) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Millisecond

Associated Types

type Time (Millisecond n) Source #

type Tag (Millisecond n) Source #

(Monad m, PureAudioClockRate rate) => Clock m (PureAudioClock rate) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

Associated Types

type Time (PureAudioClock rate) Source #

type Tag (PureAudioClock rate) Source #

(Exception e, Clock IO cl, MonadIO eio, MonadError e eio) => Clock eio (ExceptClock cl e) Source # 
Instance details

Defined in FRP.Rhine.Clock.Except

Associated Types

type Time (ExceptClock cl e) Source #

type Tag (ExceptClock cl e) Source #

Methods

initClock :: ExceptClock cl e -> RunningClockInit eio (Time (ExceptClock cl e)) (Tag (ExceptClock cl e)) Source #

(Monad m, TimeDomain time, Clock m cl) => Clock m (RescaledClock cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (RescaledClock cl time) Source #

type Tag (RescaledClock cl time) Source #

Methods

initClock :: RescaledClock cl time -> RunningClockInit m (Time (RescaledClock cl time)) (Tag (RescaledClock cl time)) Source #

(MonadIO m, KnownNat bufferSize, AudioClockRate rate) => Clock m (AudioClock rate bufferSize) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

Associated Types

type Time (AudioClock rate bufferSize) Source #

type Tag (AudioClock rate bufferSize) Source #

Methods

initClock :: AudioClock rate bufferSize -> RunningClockInit m (Time (AudioClock rate bufferSize)) (Tag (AudioClock rate bufferSize)) Source #

(Monad m, Clock m cl) => Clock m (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Associated Types

type Time (SelectClock cl a) Source #

type Tag (SelectClock cl a) Source #

(TimeDomain (Time cl), Clock (ScheduleT (Diff (Time cl)) m) cl, Monad m) => Clock m (UnscheduleClock m cl) Source # 
Instance details

Defined in FRP.Rhine.Clock.Unschedule

Associated Types

type Time (UnscheduleClock m cl) Source #

type Tag (UnscheduleClock m cl) Source #

(Monad m, MonadSchedule m, Clock m cl1, Clock m cl2) => Clock m (ParallelClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

Associated Types

type Time (ParallelClock cl1 cl2) Source #

type Tag (ParallelClock cl1 cl2) Source #

Methods

initClock :: ParallelClock cl1 cl2 -> RunningClockInit m (Time (ParallelClock cl1 cl2)) (Tag (ParallelClock cl1 cl2)) Source #

(Monad m, MonadSchedule m, Clock m cl1, Clock m cl2) => Clock m (SequentialClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

Associated Types

type Time (SequentialClock cl1 cl2) Source #

type Tag (SequentialClock cl1 cl2) Source #

(Monad m, TimeDomain time, Clock m cl) => Clock m (RescaledClockM m cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (RescaledClockM m cl time) Source #

type Tag (RescaledClockM m cl time) Source #

Methods

initClock :: RescaledClockM m cl time -> RunningClockInit m (Time (RescaledClockM m cl time)) (Tag (RescaledClockM m cl time)) Source #

(Time cl1 ~ Time cl2, Clock (ExceptT e m) cl1, Clock m cl2, Monad m) => Clock m (CatchClock cl1 e cl2) Source # 
Instance details

Defined in FRP.Rhine.Clock.Except

Associated Types

type Time (CatchClock cl1 e cl2) Source #

type Tag (CatchClock cl1 e cl2) Source #

Methods

initClock :: CatchClock cl1 e cl2 -> RunningClockInit m (Time (CatchClock cl1 e cl2)) (Tag (CatchClock cl1 e cl2)) Source #

(Monad m1, Monad m2, Clock m1 cl) => Clock m2 (HoistClock m1 m2 cl) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (HoistClock m1 m2 cl) Source #

type Tag (HoistClock m1 m2 cl) Source #

Methods

initClock :: HoistClock m1 m2 cl -> RunningClockInit m2 (Time (HoistClock m1 m2 cl)) (Tag (HoistClock m1 m2 cl)) Source #

(Monad m, TimeDomain time, Clock m cl) => Clock m (RescaledClockS m cl time tag) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (RescaledClockS m cl time tag) Source #

type Tag (RescaledClockS m cl time tag) Source #

Methods

initClock :: RescaledClockS m cl time tag -> RunningClockInit m (Time (RescaledClockS m cl time tag)) (Tag (RescaledClockS m cl time tag)) Source #

(TimeDomain time, MonadError e m) => Clock m (Single m time tag e) Source # 
Instance details

Defined in FRP.Rhine.Clock.Except

Associated Types

type Time (Single m time tag e) Source #

type Tag (Single m time tag e) Source #

Methods

initClock :: Single m time tag e -> RunningClockInit m (Time (Single m time tag e)) (Tag (Single m time tag e)) Source #

(MonadSchedule m, Monad m) => Clock (ScheduleT Integer m) (FixedStep n) Source # 
Instance details

Defined in FRP.Rhine.Clock.FixedStep

Associated Types

type Time (FixedStep n) Source #

type Tag (FixedStep n) Source #

(Monad m, NonemptyNatList v) => Clock (ScheduleT Integer m) (Periodic v) Source # 
Instance details

Defined in FRP.Rhine.Clock.Periodic

Associated Types

type Time (Periodic v) Source #

type Tag (Periodic v) Source #

MonadIO m => Clock (EventChanT event m) (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

Associated Types

type Time (EventClock event) Source #

type Tag (EventClock event) Source #

Methods

initClock :: EventClock event -> RunningClockInit (EventChanT event m) (Time (EventClock event)) (Tag (EventClock event)) Source #

class VectorSpace v a | v -> a where #

Vector space type relation.

A vector space is a set (type) closed under addition and multiplication by a scalar. The type of the scalar is the field of the vector space, and it is said that v is a vector space over a.

The encoding uses a type class |VectorSpace| v a, where v represents the type of the vectors and a represents the types of the scalars.

Minimal complete definition

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

Methods

zeroVector :: v #

Vector with no magnitude (unit for addition).

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

Multiplication by a scalar.

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

Division by a scalar.

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

Vector addition

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

Vector subtraction

negateVector :: v -> v #

Vector negation. Addition with a negated vector should be same as subtraction.

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

Dot product (also known as scalar or inner product).

For two vectors, mathematically represented as a = a1,a2,...,an and b = b1,b2,...,bn, the dot product is a . b = a1*b1 + a2*b2 + ... + an*bn.

Some properties are derived from this. The dot product of a vector with itself is the square of its magnitude (norm), and the dot product of two orthogonal vectors is zero.

norm :: v -> a #

Vector's norm (also known as magnitude).

For a vector represented mathematically as a = a1,a2,...,an, the norm is the square root of a1^2 + a2^2 + ... + an^2.

normalize :: v -> v #

Return a vector with the same origin and orientation (angle), but such that the norm is one (the unit for multiplication by a scalar).

Instances

Instances details
VectorSpace Double Double

Vector space instance for Doubles, with Double scalars.

Instance details

Defined in Data.VectorSpace

VectorSpace Float Float

Vector space instance for Floats, with Float scalars.

Instance details

Defined in Data.VectorSpace

(Eq a, Floating a) => VectorSpace (a, a) a

Vector space instance for pairs of Floating point numbers.

Instance details

Defined in Data.VectorSpace

Methods

zeroVector :: (a, a) #

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

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

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

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

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

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

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

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

(VectorSpace v s, Eq s, Floating s, Applicative m) => VectorSpace (StreamT m v) (StreamT m s) 
Instance details

Defined in Data.Stream

Methods

zeroVector :: StreamT m v #

(*^) :: StreamT m s -> StreamT m v -> StreamT m v #

(^/) :: StreamT m v -> StreamT m s -> StreamT m v #

(^+^) :: StreamT m v -> StreamT m v -> StreamT m v #

(^-^) :: StreamT m v -> StreamT m v -> StreamT m v #

negateVector :: StreamT m v -> StreamT m v #

dot :: StreamT m v -> StreamT m v -> StreamT m s #

norm :: StreamT m v -> StreamT m s #

normalize :: StreamT m v -> StreamT m v #

(VectorSpace v s, Eq s, Floating s, Applicative m) => VectorSpace (OptimizedStreamT m v) (OptimizedStreamT m s) 
Instance details

Defined in Data.Stream.Optimized

(Eq a, Floating a) => VectorSpace (a, a, a) a

Vector space instance for triplets of Floating point numbers.

Instance details

Defined in Data.VectorSpace

Methods

zeroVector :: (a, a, a) #

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

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

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

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

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

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

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

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

(Eq s, Floating s, VectorSpace v s, Applicative m) => VectorSpace (Automaton m a v) (Automaton m a s) 
Instance details

Defined in Data.Automaton

Methods

zeroVector :: Automaton m a v #

(*^) :: Automaton m a s -> Automaton m a v -> Automaton m a v #

(^/) :: Automaton m a v -> Automaton m a s -> Automaton m a v #

(^+^) :: Automaton m a v -> Automaton m a v -> Automaton m a v #

(^-^) :: Automaton m a v -> Automaton m a v -> Automaton m a v #

negateVector :: Automaton m a v -> Automaton m a v #

dot :: Automaton m a v -> Automaton m a v -> Automaton m a s #

norm :: Automaton m a v -> Automaton m a s #

normalize :: Automaton m a v -> Automaton m a v #

(Eq a, Floating a) => VectorSpace (a, a, a, a) a

Vector space instance for tuples with four Floating point numbers.

Instance details

Defined in Data.VectorSpace

Methods

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

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

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

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

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

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

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

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

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

(Eq a, Floating a) => VectorSpace (a, a, a, a, a) a

Vector space instance for tuples with five Floating point numbers.

Instance details

Defined in Data.VectorSpace

Methods

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

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

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

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

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

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

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

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

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

data UTCTime #

This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.

Instances

Instances details
Data UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime #

toConstr :: UTCTime -> Constr #

dataTypeOf :: UTCTime -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) #

gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r #

gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #

NFData UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

rnf :: UTCTime -> () #

Eq UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

(==) :: UTCTime -> UTCTime -> Bool #

(/=) :: UTCTime -> UTCTime -> Bool #

Ord UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

TimeDomain UTCTime

Differences between UTCTimes are measured in seconds.

Instance details

Defined in Data.TimeDomain

Associated Types

type Diff UTCTime #

type Diff UTCTime 
Instance details

Defined in Data.TimeDomain

newtype NumTimeDomain a #

Any Num can be wrapped to form a TimeDomain.

Constructors

NumTimeDomain 

Fields

Instances

Instances details
Num a => Num (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

Num a => TimeDifference (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

Num a => TimeDomain (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

Associated Types

type Diff (NumTimeDomain a) #

type Diff (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

class TimeDifference d where #

A type of durations, or differences betweens time stamps.

Expected laws:

Methods

difference :: d -> d -> d #

Calculate the difference between two durations, compatibly with diffTime.

add :: d -> d -> d #

Add two time differences.

Instances

Instances details
TimeDifference Integer 
Instance details

Defined in Data.TimeDomain

TimeDifference () 
Instance details

Defined in Data.TimeDomain

Methods

difference :: () -> () -> () #

add :: () -> () -> () #

TimeDifference Double 
Instance details

Defined in Data.TimeDomain

TimeDifference Float 
Instance details

Defined in Data.TimeDomain

Methods

difference :: Float -> Float -> Float #

add :: Float -> Float -> Float #

Num a => TimeDifference (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

class TimeDifference (Diff time) => TimeDomain time where #

A time domain is an affine space representing a notion of time, such as real time, simulated time, steps, or a completely different notion.

Expected laws:

Associated Types

type Diff time #

The type of differences or durations between two timestamps

Methods

diffTime :: time -> time -> Diff time #

Compute the difference between two timestamps.

Mnemonic: diffTime behaves like the (-) operator:

diffTime earlier later = later `diffTime' earlier is the duration it takes from earlier to later.

addTime :: time -> Diff time -> time #

Add a time difference to a timestamp.

Instances

Instances details
TimeDomain UTCTime

Differences between UTCTimes are measured in seconds.

Instance details

Defined in Data.TimeDomain

Associated Types

type Diff UTCTime #

TimeDomain Integer 
Instance details

Defined in Data.TimeDomain

Associated Types

type Diff Integer #

TimeDomain () 
Instance details

Defined in Data.TimeDomain

Associated Types

type Diff () #

Methods

diffTime :: () -> () -> Diff () #

addTime :: () -> Diff () -> () #

TimeDomain Double 
Instance details

Defined in Data.TimeDomain

Associated Types

type Diff Double #

TimeDomain Float 
Instance details

Defined in Data.TimeDomain

Associated Types

type Diff Float #

Num a => TimeDomain (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

Associated Types

type Diff (NumTimeDomain a) #

type family Diff time #

The type of differences or durations between two timestamps

Instances

Instances details
type Diff UTCTime 
Instance details

Defined in Data.TimeDomain

type Diff Integer 
Instance details

Defined in Data.TimeDomain

type Diff () 
Instance details

Defined in Data.TimeDomain

type Diff () = ()
type Diff Double 
Instance details

Defined in Data.TimeDomain

type Diff Float 
Instance details

Defined in Data.TimeDomain

type Diff (NumTimeDomain a) 
Instance details

Defined in Data.TimeDomain

data Rhine m cl a b Source #

A Rhine consists of a SN together with a clock of matching type cl.

It is a reactive program, possibly with open inputs and outputs. If the input and output types a and b are both (), that is, the Rhine is "closed", then it is a standalone reactive program that can be run with the function flow.

Otherwise, one can start the clock and the signal network jointly as an automaton, using eraseClock.

Constructors

Rhine 

Fields

Instances

Instances details
GetClockProxy cl => ToClockProxy (Rhine m cl a b) Source # 
Instance details

Defined in FRP.Rhine.Type

Associated Types

type Cl (Rhine m cl a b) Source #

Methods

toClockProxy :: Rhine m cl a b -> ClockProxy (Cl (Rhine m cl a b)) Source #

type Cl (Rhine m cl a b) Source # 
Instance details

Defined in FRP.Rhine.Type

type Cl (Rhine m cl a b) = cl

type ClSF m cl a b = Automaton (ReaderT (TimeInfo cl) m) a b Source #

A (synchronous, clocked) automaton with the additional side effect of being time-aware, that is, reading the current TimeInfo of the clock cl.

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 #

data SN m cl a b where Source #

An SN is a side-effectful asynchronous signal network, where input, data processing (including side effects) and output need not happen at the same time.

The type parameters are:

  • m: The monad in which side effects take place.
  • cl: The clock of the whole signal network. It may be sequentially or parallely composed from other clocks.
  • a: The input type. Input arrives at the rate In cl.
  • b: The output type. Output arrives at the rate Out cl.

Constructors

Synchronous :: (cl ~ In cl, cl ~ Out cl) => ClSF m cl a b -> SN m cl a b

A synchronous automaton is the basic building block. For such an SN, data enters and leaves the system at the same rate as it is processed.

Sequential :: (Clock m clab, Clock m clcd, Clock m (Out clab), Clock m (Out clcd), Clock m (In clab), Clock m (In clcd), GetClockProxy clab, GetClockProxy clcd, Time clab ~ Time clcd, Time clab ~ Time (Out clab), Time clcd ~ Time (In clcd)) => SN m clab a b -> ResamplingBuffer m (Out clab) (In clcd) b c -> SN m clcd c d -> SN m (SequentialClock clab clcd) a d

Two SNs may be sequentially composed if there is a matching ResamplingBuffer between them.

Parallel :: (Clock m cl1, Clock m cl2, Clock m (Out cl1), Clock m (Out cl2), GetClockProxy cl1, GetClockProxy cl2, Time cl1 ~ Time (Out cl1), Time cl2 ~ Time (Out cl2), Time cl1 ~ Time cl2, Time cl1 ~ Time (In cl1), Time cl2 ~ Time (In cl2)) => SN m cl1 a b -> SN m cl2 a b -> SN m (ParallelClock cl1 cl2) a b

Two SNs with the same input and output data may be parallely composed.

FirstResampling :: (Clock m (In cl), Clock m (Out cl), Time cl ~ Time (Out cl), Time cl ~ Time (In cl)) => SN m cl a b -> ResamplingBuffer m (In cl) (Out cl) c d -> SN m cl (a, c) (b, d)

Bypass the signal network by forwarding data in parallel through a ResamplingBuffer.

Postcompose :: (Clock m (Out cl), Time cl ~ Time (Out cl)) => SN m cl a b -> ClSF m (Out cl) b c -> SN m cl a c

A ClSF can always be postcomposed onto an SN if the clocks match on the output.

Precompose :: (Clock m (In cl), Time cl ~ Time (In cl)) => ClSF m (In cl) a b -> SN m cl b c -> SN m cl a c

A ClSF can always be precomposed onto an SN if the clocks match on the input.

Feedback :: (Clock m (In cl), Clock m (Out cl), Time (In cl) ~ Time cl, Time (Out cl) ~ Time cl) => ResBuf m (Out cl) (In cl) d c -> SN m cl (a, c) (b, d) -> SN m cl a b

Data can be looped back to the beginning of an SN, but it must be resampled since the Out and In clocks are generally different.

Instances

Instances details
GetClockProxy cl => ToClockProxy (SN m cl a b) Source # 
Instance details

Defined in FRP.Rhine.SN

Associated Types

type Cl (SN m cl a b) Source #

Methods

toClockProxy :: SN m cl a b -> ClockProxy (Cl (SN m cl a b)) Source #

type Cl (SN m cl a b) Source # 
Instance details

Defined in FRP.Rhine.SN

type Cl (SN m cl a b) = cl

data FixedStep (n :: Nat) where Source #

A pure (side effect free) clock with fixed step size, i.e. ticking at multiples of n. The tick rate is in the type signature, which prevents composition of signals at different rates.

Constructors

FixedStep :: KnownNat n => FixedStep n 

Instances

Instances details
GetClockProxy (FixedStep n) Source # 
Instance details

Defined in FRP.Rhine.Clock.FixedStep

(MonadSchedule m, Monad m) => Clock (ScheduleT Integer m) (FixedStep n) Source # 
Instance details

Defined in FRP.Rhine.Clock.FixedStep

Associated Types

type Time (FixedStep n) Source #

type Tag (FixedStep n) Source #

type Tag (FixedStep n) Source # 
Instance details

Defined in FRP.Rhine.Clock.FixedStep

type Tag (FixedStep n) = ()
type Time (FixedStep n) Source # 
Instance details

Defined in FRP.Rhine.Clock.FixedStep

data Periodic (v :: [Nat]) where Source #

A clock whose tick lengths cycle through a (nonempty) list of type-level natural numbers. E.g. Periodic '[1, 2] ticks at times 1, 3, 4, 5, 7, 8, etc.

The waiting side effect is formal, in ScheduleT. You can use e.g. runScheduleIO to produce an actual delay.

Constructors

Periodic :: Periodic (n : ns) 

Instances

Instances details
GetClockProxy (Periodic v) Source # 
Instance details

Defined in FRP.Rhine.Clock.Periodic

(Monad m, NonemptyNatList v) => Clock (ScheduleT Integer m) (Periodic v) Source # 
Instance details

Defined in FRP.Rhine.Clock.Periodic

Associated Types

type Time (Periodic v) Source #

type Tag (Periodic v) Source #

type Tag (Periodic v) Source # 
Instance details

Defined in FRP.Rhine.Clock.Periodic

type Tag (Periodic v) = ()
type Time (Periodic v) Source # 
Instance details

Defined in FRP.Rhine.Clock.Periodic

type Time (Periodic v) = Integer

data Busy Source #

A clock that ticks without waiting. All time passed between ticks amounts to computation time, side effects, time measurement and framework overhead.

Constructors

Busy 

Instances

Instances details
GetClockProxy Busy Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Busy

MonadIO m => Clock m Busy Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Busy

Associated Types

type Time Busy Source #

type Tag Busy Source #

type Tag Busy Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Busy

type Tag Busy = ()
type Time Busy Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Busy

newtype Millisecond (n :: Nat) Source #

A clock ticking every n milliseconds, in real time.

Since n is in the type signature, it is ensured that when composing two signals on a Millisecond clock, they will be driven at the same rate.

For example, Millisecond 100 ticks every 0.1 seconds, so 10 times per seconds.

The tag of this clock is 'Maybe Double', where Nothing represents successful realtime, and Just lag a lag (in seconds).

Instances

Instances details
Clock IO (Millisecond n) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Millisecond

Associated Types

type Time (Millisecond n) Source #

type Tag (Millisecond n) Source #

GetClockProxy (Millisecond n) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Millisecond

type Tag (Millisecond n) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Millisecond

type Time (Millisecond n) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Millisecond

data Never Source #

A clock that never ticks.

Constructors

Never 

Instances

Instances details
GetClockProxy Never Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Never

MonadIO m => Clock m Never Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Never

Associated Types

type Time Never Source #

type Tag Never Source #

type Tag Never Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Never

type Tag Never = Void
type Time Never Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Never

data Trivial Source #

A clock that always returns the tick ().

Constructors

Trivial 

Instances

Instances details
GetClockProxy Trivial Source # 
Instance details

Defined in FRP.Rhine.Clock.Trivial

Monad m => Clock m Trivial Source # 
Instance details

Defined in FRP.Rhine.Clock.Trivial

Associated Types

type Time Trivial Source #

type Tag Trivial Source #

type Tag Trivial Source # 
Instance details

Defined in FRP.Rhine.Clock.Trivial

type Tag Trivial = ()
type Time Trivial Source # 
Instance details

Defined in FRP.Rhine.Clock.Trivial

type Time Trivial = ()

type RunningClock m time tag = Automaton m () (time, tag) Source #

A clock creates a stream of time stamps and additional information, possibly together with side effects in a monad m that cause the environment to wait until the specified time is reached.

data HoistClock m1 m2 cl Source #

Applying a monad morphism yields a new clock.

Constructors

HoistClock 

Fields

Instances

Instances details
(Monad m1, Monad m2, Clock m1 cl) => Clock m2 (HoistClock m1 m2 cl) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (HoistClock m1 m2 cl) Source #

type Tag (HoistClock m1 m2 cl) Source #

Methods

initClock :: HoistClock m1 m2 cl -> RunningClockInit m2 (Time (HoistClock m1 m2 cl)) (Tag (HoistClock m1 m2 cl)) Source #

GetClockProxy cl => GetClockProxy (HoistClock m1 m2 cl) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

type Tag (HoistClock m1 m2 cl) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Tag (HoistClock m1 m2 cl) = Tag cl
type Time (HoistClock m1 m2 cl) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Time (HoistClock m1 m2 cl) = Time cl

data TimeInfo cl Source #

An annotated, rich time stamp.

Constructors

TimeInfo 

Fields

class GetClockProxy cl where Source #

Clocks should be able to automatically generate a proxy for themselves.

Minimal complete definition

Nothing

Methods

getClockProxy :: ClockProxy cl Source #

default getClockProxy :: (cl ~ In cl, cl ~ Out cl) => ClockProxy cl Source #

Instances

Instances details
GetClockProxy Busy Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Busy

GetClockProxy Never Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Never

GetClockProxy StdinClock Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Stdin

GetClockProxy Trivial Source # 
Instance details

Defined in FRP.Rhine.Clock.Trivial

GetClockProxy (FixedStep n) Source # 
Instance details

Defined in FRP.Rhine.Clock.FixedStep

GetClockProxy (Periodic v) Source # 
Instance details

Defined in FRP.Rhine.Clock.Periodic

GetClockProxy (PureAudioClock rate) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

GetClockProxy (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

GetClockProxy (Millisecond n) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Millisecond

GetClockProxy cl => GetClockProxy (RescaledClock cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

GetClockProxy (ExceptClock cl e) Source # 
Instance details

Defined in FRP.Rhine.Clock.Except

GetClockProxy (AudioClock rate bufferSize) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

Methods

getClockProxy :: ClockProxy (AudioClock rate bufferSize) Source #

GetClockProxy (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

(GetClockProxy cl1, GetClockProxy cl2) => GetClockProxy (ParallelClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

(GetClockProxy cl1, GetClockProxy cl2) => GetClockProxy (SequentialClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

GetClockProxy cl => GetClockProxy (HoistClock m1 m2 cl) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

GetClockProxy cl => GetClockProxy (RescaledClockM m cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

GetClockProxy (CatchClock cl1 e cl2) Source # 
Instance details

Defined in FRP.Rhine.Clock.Except

GetClockProxy cl => GetClockProxy (RescaledClockS m cl time tag) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

Methods

getClockProxy :: ClockProxy (RescaledClockS m cl time tag) Source #

data ClockProxy cl where Source #

Witnesses the structure of a clock type, in particular whether SequentialClocks or ParallelClocks are involved.

Constructors

LeafProxy :: (cl ~ In cl, cl ~ Out cl) => ClockProxy cl 
SequentialProxy :: ClockProxy cl1 -> ClockProxy cl2 -> ClockProxy (SequentialClock cl1 cl2) 
ParallelProxy :: ClockProxy clL -> ClockProxy clR -> ClockProxy (ParallelClock clL clR) 

data AudioClock (rate :: AudioRate) (bufferSize :: Nat) Source #

A clock for audio analysis and synthesis. It internally processes samples in buffers of size bufferSize, (the programmer does not have to worry about this), at a sample rate of rate (of type AudioRate). Both these parameters are in the type signature, so it is not possible to compose signals with different buffer sizes or sample rates.

After processing a buffer, the clock will wait the remaining time until the next buffer must be processed, using system UTC time. The tag of the clock specifies whether the attempt to finish the last buffer in real time was successful. A value of Nothing represents success, a value of Just double represents a lag of double seconds.

Constructors

AudioClock 

Instances

Instances details
(MonadIO m, KnownNat bufferSize, AudioClockRate rate) => Clock m (AudioClock rate bufferSize) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

Associated Types

type Time (AudioClock rate bufferSize) Source #

type Tag (AudioClock rate bufferSize) Source #

Methods

initClock :: AudioClock rate bufferSize -> RunningClockInit m (Time (AudioClock rate bufferSize)) (Tag (AudioClock rate bufferSize)) Source #

GetClockProxy (AudioClock rate bufferSize) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

Methods

getClockProxy :: ClockProxy (AudioClock rate bufferSize) Source #

type Tag (AudioClock rate bufferSize) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

type Tag (AudioClock rate bufferSize) = Maybe Double
type Time (AudioClock rate bufferSize) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

type Time (AudioClock rate bufferSize) = UTCTime

data AudioRate Source #

Rates at which audio signals are typically sampled.

Constructors

Hz44100 
Hz48000 
Hz96000 

data PureAudioClock (rate :: AudioRate) Source #

A side-effect free clock for audio synthesis and analysis. The sample rate is given by rate (of type AudioRate). Since this clock does not wait for the completion of buffers, the producer or the consumer of the signal has the obligation to synchronise the signal with the system clock, if realtime is desired. Otherwise, the clock is also suitable e.g. for batch processing of audio files.

Constructors

PureAudioClock 

Instances

Instances details
(Monad m, PureAudioClockRate rate) => Clock m (PureAudioClock rate) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

Associated Types

type Time (PureAudioClock rate) Source #

type Tag (PureAudioClock rate) Source #

GetClockProxy (PureAudioClock rate) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

type Tag (PureAudioClock rate) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

type Tag (PureAudioClock rate) = ()
type Time (PureAudioClock rate) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Audio

type Time (PureAudioClock rate) = Double

type PureAudioClockF (rate :: AudioRate) = RescaledClock (PureAudioClock rate) Float Source #

A rescaled version of PureAudioClock with TimeDomain Float.

type EventChanT event m = ReaderT (Chan event) m Source #

A monad transformer in which events can be emitted onto a Chan.

data StdinClock Source #

A clock that ticks for every line entered on the console, outputting the entered line as its Tag.

Constructors

StdinClock 

data SelectClock cl a Source #

A clock that selects certain subevents of type a, from the tag of a main clock.

If two SelectClocks would tick on the same type of subevents, but should not have the same type, one should newtype the subevent.

Constructors

SelectClock 

Fields

  • mainClock :: cl

    The main clock | Return Nothing if no tick of the subclock is required, or 'Just a' if the subclock should tick, with tag a.

  • select :: Tag cl -> Maybe a
     

Instances

Instances details
(Monad m, Clock m cl) => Clock m (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Associated Types

type Time (SelectClock cl a) Source #

type Tag (SelectClock cl a) Source #

(Monoid cl, Semigroup a) => Monoid (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Methods

mempty :: SelectClock cl a #

mappend :: SelectClock cl a -> SelectClock cl a -> SelectClock cl a #

mconcat :: [SelectClock cl a] -> SelectClock cl a #

(Semigroup a, Semigroup cl) => Semigroup (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

Methods

(<>) :: SelectClock cl a -> SelectClock cl a -> SelectClock cl a #

sconcat :: NonEmpty (SelectClock cl a) -> SelectClock cl a #

stimes :: Integral b => b -> SelectClock cl a -> SelectClock cl a #

GetClockProxy (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

type Tag (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

type Tag (SelectClock cl a) = a
type Time (SelectClock cl a) Source # 
Instance details

Defined in FRP.Rhine.Clock.Select

type Time (SelectClock cl a) = Time cl

data UnscheduleClock m cl Source #

If cl is a Clock in 'ScheduleT diff m', apply UnscheduleClock to get a clock in m.

Constructors

UnscheduleClock 

Fields

Instances

Instances details
(TimeDomain (Time cl), Clock (ScheduleT (Diff (Time cl)) m) cl, Monad m) => Clock m (UnscheduleClock m cl) Source # 
Instance details

Defined in FRP.Rhine.Clock.Unschedule

Associated Types

type Time (UnscheduleClock m cl) Source #

type Tag (UnscheduleClock m cl) Source #

type Tag (UnscheduleClock m cl) Source # 
Instance details

Defined in FRP.Rhine.Clock.Unschedule

type Tag (UnscheduleClock m cl) = Tag cl
type Time (UnscheduleClock m cl) Source # 
Instance details

Defined in FRP.Rhine.Clock.Unschedule

type Time (UnscheduleClock m cl) = Time cl

data AsyncMealy m s a b Source #

An asynchronous, effectful Mealy machine description. (Input and output do not happen simultaneously.) It can be used to create ResamplingBuffers.

Constructors

AsyncMealy 

Fields

  • amPut :: s -> a -> m s

    Given the previous state and an input value, return the new state.

  • amGet :: s -> m (Result s b)

    Given the previous state, return an output value and a new state.

type family Out cl where ... Source #

The clock that represents the rate at which data leaves the system.

Equations

Out (SequentialClock cl1 cl2) = Out cl2 
Out (ParallelClock cl1 cl2) = ParallelClock (Out cl1) (Out cl2) 
Out cl = cl 

type RunningClockInit m time tag = m (RunningClock m time tag, time) Source #

When initialising a clock, the initial time is measured (typically by means of a side effect), and a running clock is returned.

type Rescaling cl time = Time cl -> time Source #

A pure morphism of time domains is just a function.

type RescalingM m cl time = Time cl -> m time Source #

An effectful morphism of time domains is a Kleisli arrow. It can use a side effect to rescale a point in one time domain into another one.

type RescalingS m cl time tag = Automaton m (Time cl, Tag cl) (time, tag) Source #

An effectful, stateful morphism of time domains is an Automaton that uses side effects to rescale a point in one time domain into another one.

type RescalingSInit m cl time tag = Time cl -> m (RescalingS m cl time tag, time) Source #

Like RescalingS, but allows for an initialisation of the rescaling morphism, together with the initial time.

data RescaledClock cl time Source #

Applying a morphism of time domains yields a new clock.

Constructors

RescaledClock 

Fields

Instances

Instances details
(Monad m, TimeDomain time, Clock m cl) => Clock m (RescaledClock cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (RescaledClock cl time) Source #

type Tag (RescaledClock cl time) Source #

Methods

initClock :: RescaledClock cl time -> RunningClockInit m (Time (RescaledClock cl time)) (Tag (RescaledClock cl time)) Source #

GetClockProxy cl => GetClockProxy (RescaledClock cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

type Tag (RescaledClock cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Tag (RescaledClock cl time) = Tag cl
type Time (RescaledClock cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Time (RescaledClock cl time) = time

data RescaledClockM m cl time Source #

Instead of a mere function as morphism of time domains, we can transform one time domain into the other with an effectful morphism.

Constructors

RescaledClockM 

Fields

Instances

Instances details
(Monad m, TimeDomain time, Clock m cl) => Clock m (RescaledClockM m cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (RescaledClockM m cl time) Source #

type Tag (RescaledClockM m cl time) Source #

Methods

initClock :: RescaledClockM m cl time -> RunningClockInit m (Time (RescaledClockM m cl time)) (Tag (RescaledClockM m cl time)) Source #

GetClockProxy cl => GetClockProxy (RescaledClockM m cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

type Tag (RescaledClockM m cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Tag (RescaledClockM m cl time) = Tag cl
type Time (RescaledClockM m cl time) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Time (RescaledClockM m cl time) = time

data RescaledClockS m cl time tag Source #

Instead of a mere function as morphism of time domains, we can transform one time domain into the other with an automaton.

Constructors

RescaledClockS 

Fields

  • unscaledClockS :: cl

    The clock before the rescaling

  • rescaleS :: RescalingSInit m cl time tag

    The rescaling stream function, and rescaled initial time, depending on the initial time before rescaling

Instances

Instances details
(Monad m, TimeDomain time, Clock m cl) => Clock m (RescaledClockS m cl time tag) Source # 
Instance details

Defined in FRP.Rhine.Clock

Associated Types

type Time (RescaledClockS m cl time tag) Source #

type Tag (RescaledClockS m cl time tag) Source #

Methods

initClock :: RescaledClockS m cl time tag -> RunningClockInit m (Time (RescaledClockS m cl time tag)) (Tag (RescaledClockS m cl time tag)) Source #

GetClockProxy cl => GetClockProxy (RescaledClockS m cl time tag) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

Methods

getClockProxy :: ClockProxy (RescaledClockS m cl time tag) Source #

type Tag (RescaledClockS m cl time tag) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Tag (RescaledClockS m cl time tag) = tag
type Time (RescaledClockS m cl time tag) Source # 
Instance details

Defined in FRP.Rhine.Clock

type Time (RescaledClockS m cl time tag) = time

type LiftClock m t cl = HoistClock m (t m) cl Source #

Lift a clock type into a monad transformer.

type IOClock m cl = HoistClock IO m cl Source #

Lift a clock type into MonadIO.

type ClSignal m cl a = forall arbitrary. ClSF m cl arbitrary a Source #

A clocked signal is a ClSF with no input required. It produces its output on its own.

type Behaviour m time a = forall cl. time ~ Time cl => ClSignal m cl a Source #

A (side-effectful) behaviour is a time-aware stream that doesn't depend on a particular clock. time denotes the TimeDomain.

type Behavior m time a = Behaviour m time a Source #

Compatibility to U.S. american spelling.

type BehaviourF m time a b = forall cl. time ~ Time cl => ClSF m cl a b Source #

A (side-effectful) behaviour function is a time-aware synchronous stream function that doesn't depend on a particular clock. time denotes the TimeDomain.

type BehaviorF m time a b = BehaviourF m time a b Source #

Compatibility to U.S. american spelling.

type ClSFExcept cl a b m e = AutomatonExcept a b (ReaderT (TimeInfo cl) m) e Source #

A synchronous exception-throwing signal function.

It is based on a newtype from automaton, AutomatonExcept, to exhibit a monad interface in the exception type. return then corresponds to throwing an exception, and (>>=) is exception handling. (For more information, see the documentation of AutomatonExcept.)

  • cl: The clock on which the signal function ticks
  • a: The input type
  • b: The output type
  • m: The monad that the signal function may take side effects in
  • e: The type of exceptions that can be thrown

type BehaviourFExcept time a b m e = forall cl. time ~ Time cl => ClSFExcept cl a b m e Source #

A clock polymorphic ClSFExcept, or equivalently an exception-throwing behaviour. Any clock with time domain time may occur.

type BehaviorFExcept time a b m e = BehaviourFExcept time a b m e Source #

Compatibility to U.S. american spelling.

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

A type synonym to allow for abbreviation.

data SequentialClock cl1 cl2 Source #

Two clocks can be combined with a schedule as a clock for an asynchronous sequential composition of signal networks.

Constructors

Time cl1 ~ Time cl2 => SequentialClock 

Fields

Instances

Instances details
(Monad m, MonadSchedule m, Clock m cl1, Clock m cl2) => Clock m (SequentialClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

Associated Types

type Time (SequentialClock cl1 cl2) Source #

type Tag (SequentialClock cl1 cl2) Source #

(GetClockProxy cl1, GetClockProxy cl2) => GetClockProxy (SequentialClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

type Tag (SequentialClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

type Tag (SequentialClock cl1 cl2) = Either (Tag cl1) (Tag cl2)
type Time (SequentialClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

type Time (SequentialClock cl1 cl2) = Time cl1

type SeqClock cl1 cl2 = SequentialClock cl1 cl2 Source #

Abbrevation synonym.

data ParallelClock cl1 cl2 Source #

Two clocks can be combined with a schedule as a clock for an asynchronous parallel composition of signal networks.

Constructors

Time cl1 ~ Time cl2 => ParallelClock 

Fields

Instances

Instances details
(Monad m, MonadSchedule m, Clock m cl1, Clock m cl2) => Clock m (ParallelClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

Associated Types

type Time (ParallelClock cl1 cl2) Source #

type Tag (ParallelClock cl1 cl2) Source #

Methods

initClock :: ParallelClock cl1 cl2 -> RunningClockInit m (Time (ParallelClock cl1 cl2)) (Tag (ParallelClock cl1 cl2)) Source #

(GetClockProxy cl1, GetClockProxy cl2) => GetClockProxy (ParallelClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Clock.Proxy

type Tag (ParallelClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

type Tag (ParallelClock cl1 cl2) = Either (Tag cl1) (Tag cl2)
type Time (ParallelClock cl1 cl2) Source # 
Instance details

Defined in FRP.Rhine.Schedule

type Time (ParallelClock cl1 cl2) = Time cl1

type ParClock cl1 cl2 = ParallelClock cl1 cl2 Source #

Abbrevation synonym.

data LastTime cl where Source #

A tree representing possible last times to which the constituents of a clock may have ticked.

Constructors

SequentialLastTime :: LastTime cl1 -> LastTime cl2 -> LastTime (SequentialClock cl1 cl2) 
ParallelLastTime :: LastTime cl1 -> LastTime cl2 -> LastTime (ParallelClock cl1 cl2) 
LeafLastTime :: Time cl -> LastTime cl 

data ParClockInclusion clS cl where Source #

An inclusion of a clock into a tree of parallel compositions of clocks.

class ToClockProxy a where Source #

Extract a clock proxy from a type.

Minimal complete definition

Nothing

Associated Types

type Cl a :: Type Source #

Methods

toClockProxy :: a -> ClockProxy (Cl a) Source #

default toClockProxy :: GetClockProxy (Cl a) => a -> ClockProxy (Cl a) Source #

Instances

Instances details
GetClockProxy cl => ToClockProxy (SN m cl a b) Source # 
Instance details

Defined in FRP.Rhine.SN

Associated Types

type Cl (SN m cl a b) Source #

Methods

toClockProxy :: SN m cl a b -> ClockProxy (Cl (SN m cl a b)) Source #

GetClockProxy cl => ToClockProxy (Rhine m cl a b) Source # 
Instance details

Defined in FRP.Rhine.Type

Associated Types

type Cl (Rhine m cl a b) Source #

Methods

toClockProxy :: Rhine m cl a b -> ClockProxy (Cl (Rhine m cl a b)) Source #

data EventClock event Source #

A clock that ticks whenever an event is emitted. It is not yet bound to a specific channel, since ideally, the correct channel is created automatically by runEventChanT. If you want to create the channel manually and bind the clock to it, use eventClockOn.

Constructors

EventClock 

Instances

Instances details
Semigroup (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

Methods

(<>) :: EventClock event -> EventClock event -> EventClock event #

sconcat :: NonEmpty (EventClock event) -> EventClock event #

stimes :: Integral b => b -> EventClock event -> EventClock event #

GetClockProxy (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

MonadIO m => Clock (EventChanT event m) (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

Associated Types

type Time (EventClock event) Source #

type Tag (EventClock event) Source #

Methods

initClock :: EventClock event -> RunningClockInit (EventChanT event m) (Time (EventClock event)) (Tag (EventClock event)) Source #

type Tag (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

type Tag (EventClock event) = event
type Time (EventClock event) Source # 
Instance details

Defined in FRP.Rhine.Clock.Realtime.Event

type Time (EventClock event) = UTCTime

type Count = FixedStep 1 Source #

A singleton clock that counts the ticks.

data RhineAndResamplingBuffer m cl1 inCl2 a c Source #

A purely syntactical convenience construction enabling quadruple syntax for sequential composition, as described below.

Constructors

forall b. RhineAndResamplingBuffer (Rhine m cl1 a b) (ResamplingBuffer m (Out cl1) inCl2 b c) 

liftCallCC :: CallCC m (Either e a) (Either e b) -> CallCC (ExceptT e m) a b #

Lift a callCC operation to the new monad.

liftListen :: Monad m => Listen w m (Either e a) -> Listen w (ExceptT e m) a #

Lift a listen operation to the new monad.

liftPass :: Monad m => Pass w m (Either e a) -> Pass w (ExceptT e m) a #

Lift a pass operation to the new monad.

parallely :: forall (m :: Type -> Type) a b. Applicative m => Automaton m a b -> Automaton m [a] [b] #

Launch arbitrarily many copies of the automaton in parallel.

  • The copies of the automaton are launched on demand as the input lists grow.
  • The n-th copy will always receive the n-th input.
  • If the input list has length n, the n+1-th automaton copy will not be stepped.

Caution: Uses memory of the order of the largest list that was ever input during runtime.

concatS :: forall (m :: Type -> Type) b. Monad m => Automaton m () [b] -> Automaton m () b #

Buffer the output of an automaton. See concatS.

runExceptT :: ExceptT e m a -> m (Either e a) #

The inverse of ExceptT.

throwE :: forall (m :: Type -> Type) e a. Monad m => e -> ExceptT e m a #

Signal an exception value e.

pass :: Monad m => Automaton (ExceptT e m) a a Source #

Do not throw an exception.

step :: Monad m => (a -> m (b, e)) -> ClSFExcept cl a b m e Source #

Advances a single tick with the given Kleisli arrow, and then throws an exception.

unfold #

Arguments

:: forall (m :: Type -> Type) s a b. Applicative m 
=> s

The initial state

-> (a -> s -> Result s b)

The step function

-> Automaton m a b 

Create an Automaton from a state and a pure step function.

unfold_ #

Arguments

:: forall (m :: Type -> Type) s a. Applicative m 
=> s

The initial state

-> (a -> s -> s)

The step function

-> Automaton m a s 

Like unfold, but output the current state.

constM :: Functor m => m b -> Automaton m a b #

Produce output effectfully, without keeping internal state

reactimate :: Monad m => Automaton m () () -> m void #

Run an automaton with trivial input and output indefinitely.

If the input and output of an automaton does not contain information, all of its meaning is in its effects. This function runs the automaton indefinitely. Since it will never return with a value, this function also has no output (its output is void). The only way it can return is if m includes some effect of termination, e.g. Maybe or Either could terminate with a Nothing or Left value, or IO can raise an exception.

exceptS :: forall (m :: Type -> Type) e a b. (Functor m, Monad m) => Automaton (ExceptT e m) a b -> Automaton m a (Either e b) #

Escape an ExceptT layer by outputting the exception whenever it occurs.

If an exception occurs, the current state is is tested again on the next input.

safely :: forall (m :: Type -> Type) a b. Monad m => AutomatonExcept a b m Void -> Automaton m a b #

If no exception can occur, the Automaton can be executed without the ExceptT layer.

Used to exit the AutomatonExcept context, often in combination with safe:

automaton = safely $ do
  e <- try someAutomaton
  once $ input -> putStrLn $ "Whoops, something happened when receiving input " ++ show input ++ ": " ++ show e ++ ", but I'll continue now."
  safe fallbackAutomaton

unfoldM #

Arguments

:: s

The initial state

-> (a -> s -> m (Result s b))

The step function

-> Automaton m a b 

Create an Automaton from a state and an effectful step function.

arrM :: Functor m => (a -> m b) -> Automaton m a b #

Consume an input and produce output effectfully, without keeping internal state

hoistS :: Monad m => (forall x. m x -> n x) -> Automaton m a b -> Automaton n a b #

Apply an arbitrary monad morphism to an automaton.

liftS :: forall (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) a b. (MonadTrans t, Monad m, Functor (t m)) => Automaton m a b -> Automaton (t m) a b #

Lift the monad of an automaton to a transformer.

feedback #

Arguments

:: forall (m :: Type -> Type) c a b. Functor m 
=> c

The additional internal state

-> Automaton m (a, c) (b, c)

The original automaton

-> Automaton m a b 

Extend the internal state and feed back part of the output to the next input.

This is one of the fundamental ways to incorporate recursive dataflow in automata. Given an automaton which consumes an additional input and produces an additional output, the state of the automaton is extended by a further value. This value is used as the additional input, and the resulting additional output is stored in the internal state for the next step.

stepAutomaton :: Functor m => Automaton m a b -> a -> m (Result (Automaton m a b) b) #

Run one step of an automaton.

This consumes an input value, performs a side effect, and returns an updated automaton together with an output value.

embed #

Arguments

:: Monad m 
=> Automaton m a b

The automaton to run

-> [a]

The input values

-> m [b] 

Run an automaton with given input, for a given number of steps.

Especially for tests and batch processing, it is useful to step an automaton with given input.

withAutomaton :: (Functor m1, Functor m2) => (forall s. (a1 -> m1 (Result s b1)) -> a2 -> m2 (Result s b2)) -> Automaton m1 a1 b1 -> Automaton m2 a2 b2 #

Change the output type and effect of an automaton without changing its state type.

mapMaybeS :: forall (m :: Type -> Type) a b. Monad m => Automaton m a b -> Automaton m (Maybe a) (Maybe b) #

Only step the automaton if the input is Just.

traverseS :: forall (m :: Type -> Type) f a b. (Monad m, Traversable f) => Automaton m a b -> Automaton m (f a) (f b) #

Use an Automaton with a variable amount of input.

traverseS_ :: forall (m :: Type -> Type) f a b. (Monad m, Traversable f) => Automaton m a b -> Automaton m (f a) () #

Like traverseS, discarding the output.

handleAutomaton_ :: forall (m :: Type -> Type) a b i. Monad m => (forall (m1 :: Type -> Type). Monad m1 => StreamT m1 a -> StreamT m1 b) -> Automaton m i a -> Automaton m i b #

Given a transformation of streams, apply it to an automaton, without changing the input.

handleAutomaton :: forall (m :: Type -> Type) a b c (n :: Type -> Type) d. Monad m => (StreamT (ReaderT a m) b -> StreamT (ReaderT c n) d) -> Automaton m a b -> Automaton n c d #

Given a transformation of streams, apply it to an automaton. The input can be accessed through the ReaderT effect.

withSideEffect #

Arguments

:: Monad m 
=> (a -> m b)

For every value passing through the automaton, this function is called and the resulting side effect performed.

-> Automaton m a a 

Pass through a value unchanged, and perform a side effect depending on it

accumulateWith #

Arguments

:: forall (m :: Type -> Type) a b. Monad m 
=> (a -> b -> b)

The accumulation function

-> b

The initial accumulator

-> Automaton m a b 

Accumulate the input, output the accumulator.

mappendFrom :: forall w (m :: Type -> Type). (Monoid w, Monad m) => w -> Automaton m w w #

Like accumulateWith, with mappend as the accumulation function.

delay #

Arguments

:: forall (m :: Type -> Type) a. Applicative m 
=> a

The value to output on the first step

-> Automaton m a a 

Delay the input by one step.

prepend :: forall (m :: Type -> Type) b a. Monad m => b -> Automaton m a b -> Automaton m a b #

Delay an automaton by one step by prepending one value to the output.

On the first step, the given initial output is returned. On all subsequent steps, the automaton is stepped with the previous input.

mappendS :: forall w (m :: Type -> Type). (Monoid w, Monad m) => Automaton m w w #

Like mappendFrom, initialised at mempty.

sumFrom :: forall v s (m :: Type -> Type). (VectorSpace v s, Monad m) => v -> Automaton m v v #

Sum up all inputs so far, with an explicit initial value.

sumS :: forall (m :: Type -> Type) v s. (Monad m, VectorSpace v s) => Automaton m v v #

Like sumFrom, initialised at 0.

sumN :: forall (m :: Type -> Type) a. (Monad m, Num a) => Automaton m a a #

Sum up all inputs so far, initialised at 0.

count :: forall n (m :: Type -> Type) a. (Num n, Monad m) => Automaton m a n #

Count the natural numbers, beginning at 1.

lastS :: forall (m :: Type -> Type) a. Monad m => a -> Automaton m (Maybe a) a #

Remembers the last Just value, defaulting to the given initialisation value.

readerS :: Monad m => ClSF m cl (a, r) b -> ClSF (ReaderT r m) cl a b Source #

Create ("wrap") a ReaderT layer in the monad stack of a behaviour. Each tick, the ReaderT side effect is performed by passing the original behaviour the extra r input.

runReaderS :: Monad m => ClSF (ReaderT r m) cl a b -> ClSF m cl (a, r) b Source #

Remove ("run") a ReaderT layer from the monad stack by making it an explicit input to the behaviour.

runReaderS_ :: Monad m => ClSF (ReaderT r m) cl a b -> r -> ClSF m cl a b Source #

Remove a ReaderT layer by passing the readonly environment explicitly.

getRandomS :: (MonadRandom m, Random a) => Behaviour m time a Source #

Produce a random value at every tick.

getRandomsS :: forall (m :: Type -> Type) b a. (MonadRandom m, Random b) => Automaton m a [b] #

Create a stream of lists of random values.

getRandomRS :: (MonadRandom m, Random a) => BehaviourF m time (a, a) a Source #

Produce a random value at every tick, within a range given per tick.

getRandomRS_ :: (MonadRandom m, Random a) => (a, a) -> Behaviour m time a Source #

Produce a random value at every tick, within a range given once.

getRandomsRS :: forall (m :: Type -> Type) b a. (MonadRandom m, Random b) => (b, b) -> Automaton m a [b] #

Create a stream of lists of random values in a given fixed range.

getRandomsRS_ :: forall (m :: Type -> Type) b. (MonadRandom m, Random b) => Automaton m (b, b) [b] #

Create a stream of lists of random values in a given range, where the range is specified on every tick.

runRandS Source #

Arguments

:: (RandomGen g, Monad m) 
=> ClSF (RandT g m) cl a b 
-> g

The initial random seed

-> ClSF m cl a (g, b) 

Generates random values, updating the generator on every step.

evalRandS :: (RandomGen g, Monad m) => ClSF (RandT g m) cl a b -> g -> ClSF m cl a b Source #

Updates the generator every step but discards the generator.

throwOnCond :: Monad m => (a -> Bool) -> e -> ClSF (ExceptT e m) cl a a Source #

Throw the exception e whenever the function evaluates to True.

throwOnCondM :: Monad m => (a -> m Bool) -> e -> ClSF (ExceptT e m) cl a a Source #

Variant of throwOnCond for Kleisli arrows. Throws the exception when the input is True.

throwOn :: Monad m => e -> ClSF (ExceptT e m) cl Bool () Source #

Throw the given exception when the Bool turns true.

throwOn' :: Monad m => ClSF (ExceptT e m) cl (Bool, e) () Source #

Variant of throwOn, where the exception can vary every tick.

throwMaybe :: Monad m => ClSF (ExceptT e m) cl (Maybe e) (Maybe a) Source #

When the input is Just e, throw the exception e.

throwS :: Monad m => ClSF (ExceptT e m) cl e a Source #

Immediately throw the incoming exception.

throw :: Monad m => e -> Automaton (ExceptT e m) a b Source #

Immediately throw the given exception.

runAutomatonExcept :: forall (m :: Type -> Type) a b e. Monad m => AutomatonExcept a b m e -> Automaton (ExceptT e m) a b #

try :: Monad m => ClSF (ExceptT e m) cl a b -> ClSFExcept cl a b m e Source #

Enter the monad context in the exception for ClSFs in the ExceptT monad. The ClSF will be run until it encounters an exception.

currentInput :: forall (m :: Type -> Type) e b. Monad m => AutomatonExcept e b m e #

Immediately throw the current input as an exception.

Useful inside AutomatonExcept if you don't want to advance a further step in execution, but first see what the current input is before continuing.

safe :: forall (m :: Type -> Type) a b e. Monad m => Automaton m a b -> AutomatonExcept a b m e #

An Automaton without an ExceptT layer never throws an exception, and can thus have an arbitrary exception type.

In particular, the exception type can be Void, so it can be used as the last statement in an AutomatonExcept do-block. See safely for an example.

once :: Monad m => (a -> m e) -> ClSFExcept cl a b m e Source #

Within the same tick, perform a monadic action, and immediately throw the value as an exception.

once_ :: Monad m => m e -> ClSFExcept cl a b m e Source #

A variant of once without input.

(>>>) :: forall {k} cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c infixr 1 #

Left-to-right composition

mapMaybe :: Monad m => ClSF m cl a b -> ClSF m cl (Maybe a) (Maybe b) Source #

Call a ClSF every time the input is 'Just a'.

Caution: This will not change the time differences since the last tick. For example, while integrate 1 is approximately the same as timeInfoOf sinceInit, mapMaybe $ integrate 1 is very different from mapMaybe $ timeInfoOf sinceInit. The former only integrates when the input is Just 1, whereas the latter always returns the correct time since initialisation.

(<<<) :: forall {k} cat (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c infixr 1 #

Right-to-left composition

returnA :: Arrow a => a b b #

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

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

Precomposition with a pure function.

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

Postcomposition with a pure function.

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

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

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

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

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.

newChan :: IO (Chan a) #

Build and returns a new instance of Chan.

collect :: Monad m => ResamplingBuffer m cl1 cl2 a [a] Source #

Collects all input in a list, with the newest element at the head, which is returned and emptied upon get.

runExcept :: Except e a -> Either e a #

Extractor for computations in the exception monad. (The inverse of except).

mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b #

Map the unwrapped computation using the given function.

withExcept :: (e -> e') -> Except e a -> Except e' a #

Transform any exceptions thrown by the computation using the given function (a specialization of withExceptT).

mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b #

Map the unwrapped computation using the given function.

withExceptT :: forall (m :: Type -> Type) e e' a. Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a #

Transform any exceptions thrown by the computation using the given function.

except :: forall (m :: Type -> Type) e a. Monad m => Either e a -> ExceptT e m a #

Constructor for computations in the exception monad. (The inverse of runExcept).

catchE #

Arguments

:: forall (m :: Type -> Type) e a e'. Monad m 
=> ExceptT e m a

the inner computation

-> (e -> ExceptT e' m a)

a handler for exceptions in the inner computation

-> ExceptT e' m a 

Handle an exception.

retag :: Time cl1 ~ Time cl2 => (Tag cl1 -> Tag cl2) -> TimeInfo cl1 -> TimeInfo cl2 Source #

A utility that changes the tag of a TimeInfo.

handleE :: forall (m :: Type -> Type) e e' a. Monad m => (e -> ExceptT e' m a) -> ExceptT e m a -> ExceptT e' m a #

The same as flip catchE, which is useful in situations where the code for the handler is shorter.

tryE :: forall (m :: Type -> Type) e a. Monad m => ExceptT e m a -> ExceptT e m (Either e a) #

Similar to catchE, but returns an Either result which is (Right a) if no exception was thown, or (Left ex) if an exception ex was thrown.

finallyE :: forall (m :: Type -> Type) e a. Monad m => ExceptT e m a -> ExceptT e m () -> ExceptT e m a #

finallyE a b executes computation a followed by computation b, even if a exits early by throwing an exception. In the latter case, the exception is re-thrown after b has been executed.

commuteReaders :: ReaderT r1 (ReaderT r2 m) a -> ReaderT r2 (ReaderT r1 m) a Source #

Commute two ReaderT transformer layers past each other

timeInfo :: Monad m => ClSF m cl a (TimeInfo cl) Source #

Read the environment variable, i.e. the TimeInfo.

pureAudioClockF :: PureAudioClockF rate Source #

A rescaled version of PureAudioClock with TimeDomain Float, using double2Float to rescale.

genTimeInfo :: (Monad m, Clock m cl) => ClockProxy cl -> Time cl -> Automaton m (Time cl, Tag cl) (TimeInfo cl) Source #

Given a clock value and an initial time, generate a stream of time stamps.

flow :: (Monad m, Clock m cl, GetClockProxy cl, Time cl ~ Time (In cl), Time cl ~ Time (Out cl)) => Rhine m cl () () -> m void Source #

Takes a closed Rhine (with trivial input and output), and runs it indefinitely. This is typically the main loop.

All input has to be created, and all output has to be consumed by means of side effects in a monad m.

Basic usage (synchronous case):

sensor :: ClSF MyMonad MyClock () a
sensor = constMCl produceData

processing :: ClSF MyMonad MyClock a b
processing = ...

actuator :: ClSF MyMonad MyClock b ()
actuator = arrMCl consumeData

mainSF :: ClSF MyMonad MyClock () ()
mainSF = sensor >-> processing >-> actuator

main :: MyMonad ()
main = flow $ mainSF @@ clock

clsfBuffer Source #

Arguments

:: Monad m 
=> ClSF m cl2 [(TimeInfo cl1, a)] b

The clocked signal function that consumes and a list of timestamped inputs, and outputs a single value. The list will contain the newest element in the head.

-> ResamplingBuffer m cl1 cl2 a b 

Given a clocked signal function that accepts a varying number of timestamped inputs (a list), a ResamplingBuffer can be formed that collects all this input and steps the signal function whenever output is requested.

fifoUnbounded :: Monad m => ResamplingBuffer m cl1 cl2 a (Maybe a) Source #

An unbounded FIFO buffer. If the buffer is empty, it will return Nothing.

linear Source #

Arguments

:: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v s, Num s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) 
=> v

The initial velocity (derivative of the signal)

-> v

The initial position

-> ResamplingBuffer m cl1 cl2 v v 

A simple linear interpolation based on the last calculated position and velocity.

keepLast :: Monad m => a -> ResamplingBuffer m cl1 cl2 a a Source #

Always keeps the last input value, or in case of no input an initialisation value. If cl2 approximates continuity, this behaves like a zero-order hold.

lifoUnbounded :: Monad m => ResamplingBuffer m cl1 cl2 a (Maybe a) Source #

An unbounded LIFO buffer. If the buffer is empty, it will return Nothing.

scheduleList :: (Monad m, MonadSchedule m) => NonEmpty (Automaton m a b) -> Automaton m a (NonEmpty b) Source #

Run several automata concurrently.

Whenever one automaton outputs a value, it is returned together with all other values that happen to be output at the same time.

rescaleMToSInit :: Monad m => (time1 -> m time2) -> time1 -> m (Automaton m (time1, tag) (time2, tag), time2) Source #

Convert an effectful morphism of time domains into a stateful one with initialisation. Think of its type as RescalingM m cl time -> RescalingSInit m cl time tag, although this type is ambiguous.

rescaledClockMToS :: Monad m => RescaledClockM m cl time -> RescaledClockS m cl time (Tag cl) Source #

A RescaledClockM is trivially a RescaledClockS.

rescaledClockToS :: Monad m => RescaledClock cl time -> RescaledClockS m cl time (Tag cl) Source #

A RescaledClock is trivially a RescaledClockS.

liftClock :: (Monad m, MonadTrans t) => cl -> LiftClock m t cl Source #

Lift a clock value into a monad transformer.

ioClock :: MonadIO m => cl -> IOClock m cl Source #

Lift a clock value into MonadIO.

hoistClSF :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> ClSF m1 cl a b -> ClSF m2 cl a b Source #

Hoist a ClSF along a monad morphism.

hoistClSFAndClock :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> ClSF m1 cl a b -> ClSF m2 (HoistClock m1 m2 cl) a b Source #

Hoist a ClSF and its clock along a monad morphism.

liftClSF :: (Monad m, MonadTrans t, Monad (t m)) => ClSF m cl a b -> ClSF (t m) cl a b Source #

Lift a ClSF into a monad transformer.

liftClSFAndClock :: (Monad m, MonadTrans t, Monad (t m)) => ClSF m cl a b -> ClSF (t m) (LiftClock m t cl) a b Source #

Lift a ClSF and its clock into a monad transformer.

timeless :: Monad m => Automaton m a b -> ClSF m cl a b Source #

An automaton without dependency on time is a ClSF for any clock.

arrMCl :: Monad m => (a -> m b) -> ClSF m cl a b Source #

Utility to lift Kleisli arrows directly to ClSFs.

constMCl :: Monad m => m b -> ClSF m cl a b Source #

Version without input.

execRandS :: (RandomGen g, Monad m) => ClSF (RandT g m) cl a b -> g -> ClSF m cl a g Source #

Updates the generator every step but discards the value, only outputting the generator.

evalRandIOS :: Monad m => ClSF (RandT StdGen m) cl a b -> IO (ClSF m cl a b) Source #

Evaluates the random computation by using the global random generator.

evalRandIOS' :: MonadIO m => ClSF (RandT StdGen m) cl a b -> ClSF m cl a b Source #

Evaluates the random computation by using the global random generator on the first tick.

runClSFExcept :: Monad m => ClSFExcept cl a b m e -> ClSF (ExceptT e m) cl a b Source #

Leave the monad context, to use the ClSFExcept as an Arrow.

timeInfoOf :: Monad m => (TimeInfo cl -> b) -> ClSF m cl a b Source #

Utility to apply functions to the current TimeInfo, such as record selectors: printAbsoluteTime :: ClSF IO cl () () printAbsoluteTime = timeInfoOf absolute >>> arrMCl print

sinceLastS :: Monad m => ClSF m cl a (Diff (Time cl)) Source #

Continuously return the time difference since the last tick.

sinceInitS :: Monad m => ClSF m cl a (Diff (Time cl)) Source #

Continuously return the time difference since clock initialisation.

absoluteS :: Monad m => ClSF m cl a (Time cl) Source #

Continuously return the absolute time.

tagS :: Monad m => ClSF m cl a (Tag cl) Source #

Continuously return the tag of the current tick.

sinceStart :: (Monad m, TimeDomain time) => BehaviourF m time a (Diff time) Source #

Calculate the time passed since this ClSF was instantiated, i.e. since the first tick on which this ClSF was run.

This is _not_ the same as sinceInitS, which measures the time since clock initialisation.

For example, the following gives a sawtooth signal:

sawtooth = safely $ do
  try $ sinceStart >>> proc time -> do
    throwOn () -time 1
    returnA    -< time
  safe sawtooth

If you replace sinceStart by sinceInitS, it will usually hang after one second, since it doesn't reset after restarting the sawtooth.

Even in the absence of conditional activation of ClSFs, there is a difference: For a clock that doesn't tick at its initialisation time, sinceStart and sinceInitS will have a constant offset of the duration between initialisation time and first tick.

keepFirst :: Monad m => ClSF m cl a a Source #

Remembers and indefinitely outputs ("holds") the first input value.

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

Alias for >>> (sequential composition) with higher operator precedence, designed to work with the other operators, e.g.:

clsf1 >-> clsf2 @@ clA |@| clsf3 >-> clsf4 @@ clB

The type signature specialises e.g. to

(>->) :: Monad m => ClSF m cl a b -> ClSF m cl b c -> ClSF m cl a c

(<-<) :: Category cat => cat b c -> cat a b -> cat a c infixl 6 Source #

Alias for <<<.

arr_ :: Arrow a => b -> a c b Source #

Output a constant value. Specialises e.g. to this type signature:

arr_ :: Monad m => b -> ClSF m cl a b

clId :: Monad m => ClSF m cl a a Source #

The identity synchronous stream function.

integralFrom :: (Monad m, VectorSpace v s, s ~ Diff td) => v -> BehaviorF m td v v Source #

The output of integralFrom v0 is the numerical Euler integral of the input, with initial offset v0.

integral :: (Monad m, VectorSpace v s, s ~ Diff td) => BehaviorF m td v v Source #

Euler integration, with zero initial offset.

derivativeFrom :: (Monad m, VectorSpace v s, s ~ Diff td) => v -> BehaviorF m td v v Source #

The output of derivativeFrom v0 is the numerical derivative of the input, with a Newton difference quotient. The input is initialised with v0.

derivative :: (Monad m, VectorSpace v s, s ~ Diff td) => BehaviorF m td v v Source #

Numerical derivative with input initialised to zero.

threePointDerivativeFrom Source #

Arguments

:: (Monad m, VectorSpace v s, s ~ Diff td, Num s) 
=> v

The initial position

-> BehaviorF m td v v 

Like derivativeFrom, but uses three samples to compute the derivative. Consequently, it is delayed by one sample.

threePointDerivative :: (Monad m, VectorSpace v s, s ~ Diff td, Num s) => BehaviorF m td v v Source #

Like threePointDerivativeFrom, but with the initial position initialised to zeroVector.

weightedAverageFrom Source #

Arguments

:: (Monad m, VectorSpace v s, s ~ Diff td, Num s) 
=> v

The initial position

-> BehaviorF m td (v, s) v 

A weighted moving average signal function. The output is the average of the first input, weighted by the second input (which is assumed to be always between 0 and 1). The weight is applied to the average of the last tick, so a weight of 1 simply repeats the past value unchanged, whereas a weight of 0 outputs the current value.

averageFrom Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, s ~ Diff td) 
=> v

The initial position

-> Diff td

The time scale on which the signal is averaged

-> BehaviorF m td v v 

An exponential moving average, or low pass. It will average out, or filter, all features below a given time constant t. (Equivalently, it filters out frequencies above 1 / (2 * pi * t).)

average Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, s ~ Diff td) 
=> Diff td

The time scale on which the signal is averaged

-> BehaviourF m td v v 

An average, or low pass, initialised to zero.

averageLinFrom Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, s ~ Diff td) 
=> v

The initial position

-> Diff td

The time scale on which the signal is averaged

-> BehaviourF m td v v 

A linearised version of averageFrom. It is more efficient, but only accurate if the supplied time scale is much bigger than the average time difference between two ticks.

averageLin Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, s ~ Diff td) 
=> Diff td

The time scale on which the signal is averaged

-> BehaviourF m td v v 

Linearised version of average.

lowPass :: (Monad m, VectorSpace v s, Floating s, s ~ Diff td) => Diff td -> BehaviourF m td v v Source #

Alias for average.

highPass Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, Eq s, s ~ Diff td) 
=> Diff td

The time constant t

-> BehaviourF m td v v 

Filters out frequencies below 1 / (2 * pi * t).

bandPass Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, Eq s, s ~ Diff td) 
=> Diff td

The time constant t

-> BehaviourF m td v v 

Filters out frequencies other than 1 / (2 * pi * t).

bandStop Source #

Arguments

:: (Monad m, VectorSpace v s, Floating s, Eq s, s ~ Diff td) 
=> Diff td

The time constant t

-> BehaviourF m td v v 

Filters out the frequency 1 / (2 * pi * t).

historySince Source #

Arguments

:: (Monad m, Ord (Diff (Time cl)), TimeDomain (Time cl)) 
=> Diff (Time cl)

The size of the time window

-> ClSF m cl a (Seq (TimeInfo cl, a)) 

Remembers all input values that arrived within a given time window. New values are appended left.

delayBy Source #

Arguments

:: (Monad m, Ord (Diff td), TimeDomain td) 
=> Diff td

The time span to delay the signal

-> BehaviorF m td a a 

Delay a signal by certain time span, initialising with the first input.

timer :: (Monad m, TimeDomain td, Ord (Diff td)) => Diff td -> BehaviorF (ExceptT () m) td a (Diff td) Source #

Throws an exception after the specified time difference, outputting the time passed since the timer was instantiated.

timer_ :: (Monad m, TimeDomain td, Ord (Diff td)) => Diff td -> BehaviorF (ExceptT () m) td a () Source #

Like timer_, but doesn't output the remaining time at all.

scaledTimer :: (Monad m, TimeDomain td, Fractional (Diff td), Ord (Diff td)) => Diff td -> BehaviorF (ExceptT () m) td a (Diff td) Source #

Like timer, but divides the remaining time by the total time.

unyieldClock :: cl -> UnscheduleClock IO cl Source #

Remove a ScheduleT layer from the monad transformer stack of the clock.

The yield action is interpreted as thread yielding in IO.

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.

timelessResamplingBuffer Source #

Arguments

:: Monad m 
=> AsyncMealy m s a b

The asynchronous Mealy machine from which the buffer is built

-> s

The initial state

-> ResamplingBuffer m cl1 cl2 a b 

A resampling buffer that is unaware of the time information of the clock, and thus clock-polymorphic. It is built from an asynchronous Mealy machine description. Whenever get is called on timelessResamplingBuffer machine s, the method amGet is called on machine with state s, discarding the time stamp. Analogously for put.

trivialResamplingBuffer :: Monad m => ResamplingBuffer m cl1 cl2 () () Source #

A resampling buffer that only accepts and emits units.

lifoBounded :: Monad m => Int -> ResamplingBuffer m cl1 cl2 a (Maybe a) Source #

A bounded LIFO buffer that forgets the oldest values when the size is above a given threshold. If the buffer is empty, it will return Nothing.

lifoWatch :: Monad m => ResamplingBuffer m cl1 cl2 a (Maybe a, Int) Source #

An unbounded LIFO buffer that also returns its current size.

fifoBounded :: Monad m => Int -> ResamplingBuffer m cl1 cl2 a (Maybe a) Source #

A bounded FIFO buffer that forgets the oldest values when the size is above a given threshold. If the buffer is empty, it will return Nothing.

fifoWatch :: Monad m => ResamplingBuffer m cl1 cl2 a (Maybe a, Int) Source #

An unbounded FIFO buffer that also returns its current size.

collectSequence :: Monad m => ResamplingBuffer m cl1 cl2 a (Seq a) Source #

Reimplementation of collect with sequences, which gives a performance benefit if the sequence needs to be reversed or searched.

pureBuffer :: Monad m => ([a] -> b) -> ResamplingBuffer m cl1 cl2 a b Source #

pureBuffer collects all input values lazily in a list and processes it when output is required. Semantically, pureBuffer f == collect >>-^ arr f, but pureBuffer is slightly more efficient.

foldBuffer Source #

Arguments

:: Monad m 
=> (a -> b -> b)

The folding function

-> b

The initial value

-> ResamplingBuffer m cl1 cl2 a b 

A buffer collecting all incoming values with a folding function. It is strict, i.e. the state value b is calculated on every put.

(>>-^) :: Monad m => ResamplingBuffer m cl1 cl2 a b -> ClSF m cl2 b c -> ResamplingBuffer m cl1 cl2 a c infix 2 Source #

Postcompose a ResamplingBuffer with a matching ClSF.

(^->>) :: Monad m => ClSF m cl1 a b -> ResamplingBuffer m cl1 cl2 b c -> ResamplingBuffer m cl1 cl2 a c infix 1 Source #

Precompose a ResamplingBuffer with a matching ClSF.

(*-*) :: Monad m => ResamplingBuffer m cl1 cl2 a b -> ResamplingBuffer m cl1 cl2 c d -> ResamplingBuffer m cl1 cl2 (a, c) (b, d) infixl 4 Source #

Parallely compose two ResamplingBuffers.

(&-&) :: Monad m => ResamplingBuffer m cl1 cl2 a b -> ResamplingBuffer m cl1 cl2 a c -> ResamplingBuffer m cl1 cl2 a (b, c) infixl 4 Source #

Parallely compose two ResamplingBuffers, duplicating the input.

timestamped :: Monad m => (forall b. ResamplingBuffer m cl clf b (f b)) -> ResamplingBuffer m cl clf a (f (a, TimeInfo cl)) Source #

Given a ResamplingBuffer where the output type depends on the input type polymorphically, we can produce a timestamped version that simply annotates every input value with the TimeInfo when it arrived.

sinc Source #

Arguments

:: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v s, Ord s, Floating s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) 
=> s

The size of the interpolation window (for how long in the past to remember incoming values)

-> ResamplingBuffer m cl1 cl2 v v 

sinc-Interpolation, or Whittaker-Shannon-Interpolation.

The incoming signal is strictly bandlimited by the frequency at which cl1 ticks. Each incoming value is hulled in a sinc function, these are added and sampled at cl2's ticks. In order not to produce a space leak, the buffer only remembers the past values within a given window, which should be chosen much larger than the average time between cl1's ticks.

cubic :: (Monad m, VectorSpace v s, Floating v, Eq v, Fractional s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) => ResamplingBuffer m cl1 cl2 v v Source #

Interpolates the signal with Hermite splines, using threePointDerivative.

Caution: In order to calculate the derivatives of the incoming signal, it has to be delayed by two ticks of cl1. In a non-realtime situation, a higher quality is achieved if the ticks of cl2 are delayed by two ticks of cl1.

schedulePair :: (Monad m, MonadSchedule m) => Automaton m a b -> Automaton m a b -> Automaton m a b Source #

Run two automata concurrently.

Whenever one automaton returns a value, it is returned.

This is similar to scheduleList, but more efficient.

runningSchedule :: (Monad m, MonadSchedule m, Clock m cl1, Clock m cl2, Time cl1 ~ Time cl2) => cl1 -> cl2 -> RunningClock m (Time cl1) (Tag cl1) -> RunningClock m (Time cl2) (Tag cl2) -> RunningClock m (Time cl1) (Either (Tag cl1) (Tag cl2)) Source #

Run two running clocks concurrently.

initSchedule :: (Time cl1 ~ Time cl2, Monad m, MonadSchedule m, Clock m cl1, Clock m cl2) => cl1 -> cl2 -> RunningClockInit m (Time cl1) (Either (Tag cl1) (Tag cl2)) Source #

A schedule implements a combination of two clocks. It outputs a time stamp and an Either value, which specifies which of the two subclocks has ticked.

parClockTagInclusion :: ParClockInclusion clS cl -> Tag clS -> Tag cl Source #

Generates a tag for the composite clock from a tag of a leaf clock, given a parallel clock inclusion.

inTag :: ClockProxy cl -> Tag cl -> Maybe (Tag (In cl)) Source #

Return the incoming tag, assuming that the incoming clock is ticked, and Nothing otherwise.

outTag :: ClockProxy cl -> Tag cl -> Maybe (Tag (Out cl)) Source #

Return the incoming tag, assuming that the outgoing clock is ticked, and Nothing otherwise.

(>>>^) :: Monad m => SN m cl a b -> (b -> c) -> SN m cl a c Source #

Postcompose a signal network with a pure function.

(^>>>) :: Monad m => (a -> b) -> SN m cl b c -> SN m cl a c Source #

Precompose a signal network with a pure function.

(>--^) :: (Clock m (Out cl), Time cl ~ Time (Out cl)) => SN m cl a b -> ClSF m (Out cl) b c -> SN m cl a c Source #

Postcompose a signal network with a ClSF.

(^-->) :: (Clock m (In cl), Time cl ~ Time (In cl)) => ClSF m (In cl) a b -> SN m cl b c -> SN m cl a c Source #

Precompose a signal network with a ClSF.

(****) :: Monad m => SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d) Source #

Compose two signal networks on the same clock in data-parallel. At one tick of cl, both networks are stepped.

(||||) :: (Monad m, Clock m clL, Clock m clR, Clock m (Out clL), Clock m (Out clR), GetClockProxy clL, GetClockProxy clR, Time clL ~ Time clR, Time clL ~ Time (Out clL), Time clL ~ Time (In clL), Time clR ~ Time (Out clR), Time clR ~ Time (In clR)) => SN m clL a b -> SN m clR a b -> SN m (ParClock clL clR) a b Source #

Compose two signal networks on different clocks in clock-parallel. At one tick of ParClock cl1 cl2, one of the networks is stepped, dependent on which constituent clock has ticked.

Note: This is essentially an infix synonym of Parallel

(++++) :: (Monad m, Clock m clL, Clock m clR, Clock m (Out clL), Clock m (Out clR), GetClockProxy clL, GetClockProxy clR, Time clL ~ Time clR, Time clL ~ Time (Out clL), Time clL ~ Time (In clL), Time clR ~ Time (Out clR), Time clR ~ Time (In clR)) => SN m clL a b -> SN m clR a c -> SN m (ParClock clL clR) a (Either b c) Source #

Compose two signal networks on different clocks in clock-parallel. At one tick of ParClock cl1 cl2, one of the networks is stepped, dependent on which constituent clock has ticked.

filterS :: Monad m => Automaton m () (Maybe b) -> Automaton m () b Source #

Helper function that runs an Automaton with Maybe output until it returns a value.

withChan :: Chan event -> EventChanT event m a -> m a Source #

Escape the EventChanT layer by explicitly providing a channel over which events are sent. Often this is not needed, and runEventChanT can be used instead.

runEventChanT :: MonadIO m => EventChanT event m a -> m a Source #

Create a channel across which events can be communicated, and subsequently execute all event effects on this channel.

Ideally, this action is run _outside_ of flow, e.g. runEventChanT $ flow myRhine. This way, exactly one channel is created.

Caution: Don't use this with hoistS, since it would create a new channel every tick. Instead, create one chan :: Chan c, e.g. with newChan, and then use withChanS.

withChanS :: Monad m => Chan event -> ClSF (EventChanT event m) cl a b -> ClSF m cl a b Source #

Remove ("run") an EventChanT layer from the monad stack by passing it explicitly the channel over which events are sent.

This is usually only needed if you can't use runEventChanT to create the channel. Typically, create a chan :: Chan c in your main program before the main loop (e.g. flow) would be run, then, by using this function, pass the channel to every behaviour or ClSF that wants to emit events, and, by using eventClockOn, to every clock that should tick on the event.

emit :: MonadIO m => event -> EventChanT event m () Source #

Emit a single event. This causes every EventClock on the same monad to tick immediately.

Be cautious when emitting events from a signal clocked by an EventClock. Nothing prevents you from emitting more events than are handled, causing the event buffer to grow indefinitely.

emitS :: MonadIO m => ClSF (EventChanT event m) cl event () Source #

Emit an event on every tick.

emitSMaybe :: MonadIO m => ClSF (EventChanT event m) cl (Maybe event) () Source #

Emit an event whenever the input value is Just event.

emit' :: (NFData event, MonadIO m) => event -> EventChanT event m () Source #

Like emit, but completely evaluates the event before emitting it.

emitS' :: (NFData event, MonadIO m) => ClSF (EventChanT event m) cl event () Source #

Like emitS, but completely evaluates the event before emitting it.

emitSMaybe' :: (NFData event, MonadIO m) => ClSF (EventChanT event m) cl (Maybe event) () Source #

Like emitSMaybe, but completely evaluates the event before emitting it.

eventClockOn :: MonadIO m => Chan event -> HoistClock (EventChanT event m) m (EventClock event) Source #

Create an event clock that is bound to a specific event channel. This is usually only useful if you can't apply runEventChanT to the main loop (see withChanS).

stepsize :: FixedStep n -> Integer Source #

Extract the type-level natural number as an integer.

downsampleFixedStep :: (KnownNat n, Monad m) => ResamplingBuffer m (FixedStep k) (FixedStep (n * k)) a (Vector n a) Source #

Resample into a FixedStep clock that ticks n times slower, by collecting all values into a vector.

waitClock :: KnownNat n => Millisecond n Source #

Tries to achieve real time by using waitUTC, see its docs.

eraseClock :: (Monad m, Clock m cl, GetClockProxy cl) => Rhine m cl a b -> m (Automaton m a (Maybe b)) Source #

Start the clock and the signal network, effectively hiding the clock type from the outside.

Since the caller will not know when the clock In cl ticks, the input a has to be given at all times, even those when it doesn't tick.

feedbackRhine :: (Clock m (In cl), Clock m (Out cl), Time (In cl) ~ Time cl, Time (Out cl) ~ Time cl) => ResamplingBuffer m (Out cl) (In cl) d c -> Rhine m cl (a, c) (b, d) -> Rhine m cl a b Source #

Loop back data from the output to the input.

Since output and input will generally tick at different clocks, the data needs to be resampled.

(@@) :: (cl ~ In cl, cl ~ Out cl) => ClSF m cl a b -> cl -> Rhine m cl a b infix 5 Source #

Create a synchronous Rhine by combining a clocked signal function with a matching clock. Synchronicity is ensured by requiring that data enters (In cl) and leaves (Out cl) the system at the same as it is processed (cl).

(>--) :: Rhine m cl1 a b -> ResamplingBuffer m (Out cl1) inCl2 b c -> RhineAndResamplingBuffer m cl1 inCl2 a c infix 2 Source #

Syntactic sugar for RhineAndResamplingBuffer.

(-->) :: (Clock m cl1, Clock m cl2, Time cl1 ~ Time cl2, Time (Out cl1) ~ Time cl1, Time (In cl2) ~ Time cl2, Clock m (Out cl1), Clock m (Out cl2), Clock m (In cl1), Clock m (In cl2), In cl2 ~ inCl2, GetClockProxy cl1, GetClockProxy cl2) => RhineAndResamplingBuffer m cl1 inCl2 a b -> Rhine m cl2 b c -> Rhine m (SequentialClock cl1 cl2) a c infixr 1 Source #

The combinators for sequential composition allow for the following syntax:

rh1   :: Rhine            m      cl1           a b
rh1   =  ...

rh2   :: Rhine            m               cl2      c d
rh2   =  ...

rb    :: ResamplingBuffer m (Out cl1) (In cl2)   b c
rb    =  ...

rh    :: Rhine m (SequentialClock cl1 cl2) a d
rh    =  rh1 >-- rb --> rh2

(+@+) :: (Monad m, Clock m clL, Clock m clR, Clock m (Out clL), Clock m (Out clR), GetClockProxy clL, GetClockProxy clR, Time clL ~ Time (Out clL), Time clR ~ Time (Out clR), Time clL ~ Time (In clL), Time clR ~ Time (In clR), Time clL ~ Time clR) => Rhine m clL a b -> Rhine m clR a c -> Rhine m (ParallelClock clL clR) a (Either b c) infix 3 Source #

The combinators for parallel composition allow for the following syntax:

rh1   :: Rhine m                clL      a         b
rh1   =  ...

rh2   :: Rhine m                    clR  a           c
rh2   =  ...

rh    :: Rhine m (ParallelClock clL clR) a (Either b c)
rh    =  rh1 +@+ rh2

(|@|) :: (Monad m, Clock m clL, Clock m clR, Clock m (Out clL), Clock m (Out clR), GetClockProxy clL, GetClockProxy clR, Time clL ~ Time (Out clL), Time clR ~ Time (Out clR), Time clL ~ Time (In clL), Time clR ~ Time (In clR), Time clL ~ Time clR) => Rhine m clL a b -> Rhine m clR a b -> Rhine m (ParallelClock clL clR) a b infix 3 Source #

The combinators for parallel composition allow for the following syntax:

rh1   :: Rhine m                clL      a b
rh1   =  ...

rh2   :: Rhine m                    clR  a b
rh2   =  ...

rh    :: Rhine m (ParallelClock clL clR) a b
rh    =  rh1 |@| rh2

(@>>^) :: Monad m => Rhine m cl a b -> (b -> c) -> Rhine m cl a c Source #

Postcompose a Rhine with a pure function.

(^>>@) :: Monad m => (a -> b) -> Rhine m cl b c -> Rhine m cl a c Source #

Precompose a Rhine with a pure function.

(@>-^) :: (Clock m (Out cl), Time cl ~ Time (Out cl)) => Rhine m cl a b -> ClSF m (Out cl) b c -> Rhine m cl a c Source #

Postcompose a Rhine with a ClSF.

(^->@) :: (Clock m (In cl), Time cl ~ Time (In cl)) => ClSF m (In cl) a b -> Rhine m cl b c -> Rhine m cl a c Source #

Precompose a Rhine with a ClSF.

flow_ :: (Monad m, Clock m cl, GetClockProxy cl, Time cl ~ Time (In cl), Time cl ~ Time (Out cl)) => Rhine m cl () () -> m () Source #

Like flow, but with the type signature specialized to m ().

This is sometimes useful when dealing with ambiguous types.

reactimateCl :: (Monad m, Clock m cl, GetClockProxy cl, cl ~ In cl, cl ~ Out cl) => cl -> ClSF m cl () () -> m () Source #

Run a synchronous ClSF with its clock as a main loop, similar to Yampa's, or Dunai's, reactimate.