Copyright  (c) George Ungureanu 20152016 

License  BSDstyle (see the file LICENSE) 
Maintainer  ugeorge@kth.se 
Stability  experimental 
Portability  portable 
Safe Haskell  Safe 
Language  Haskell2010 
This module defines the shallowembedded Stream
data type and
utility functions operating on it. In ForSyDe a signal is
represented as a (partially or totally) ordered sequence of
events that enables processes to communicate and synchronize. In
ForSyDeAtom signals are the main operating type for the MoC
layer. The Stream
type is only the base (potentially infinite)
structure which can encapsulate events in order to describe
signals.
Synopsis
 data Stream e
 stream :: [a] > Stream a
 fromStream :: Stream a > [a]
 headS :: Stream a > a
 tailS :: Stream e > Stream e
 lastS :: Stream p > p
 repeatS :: a > Stream a
 takeS :: (Num t, Ord t) => t > Stream e > Stream e
 dropS :: (Num t, Ord t) => t > Stream e > Stream e
 takeWhileS :: (a > Bool) > Stream a > Stream a
 (++) :: Stream e > Stream e > Stream e
Documentation
Defines a stream of events, encapsulating them in a structure
isomorphic to an infinite list [Bird87],
thus all properties of lists may also be applied to
Stream
s. While, in combination with lazy evaluation, it is
possible to create and simulate infinite signals, we need to ensure
that the first/previous event is always fully evaluated, which is
equivalent to ensuring the the monotonicity property in dataflow
systems. This translates in the following composition rule:
 noncausal feedback is forbidden
 also called "zerodelay" feedback loops, are caused by unevaluated selfreferential calls. In a feedback loop, there always has to be enough events to ensure the data flow.
This rule imposes that the stream of data is uninterrupted in order to have an evaluatable kernel every time a new event is produced (i.e. to avoid deadlocks), which is ther equivalent to ensuring continuity in dataflow systems. This translates in the following rule:
 cleaning of signals in a feedback is forbidden
 in other words, whenever a feedback composition occurs, for each new input at any instant in time, a process must react with at least one output event.
NullS  terminates a signal 
e : (Stream e) infixr 3  the default constructor appends an event to the head of the stream 
Instances
Functor Stream Source #  allows for the mapping of an arbitrary function 
Applicative Stream Source #  
Foldable Stream Source #  provides folding functions useful for implementing utilities, such as 
Defined in ForSyDe.Atom.MoC.Stream fold :: Monoid m => Stream m > m # foldMap :: Monoid m => (a > m) > Stream a > m # foldMap' :: Monoid m => (a > m) > Stream a > m # foldr :: (a > b > b) > b > Stream a > b # foldr' :: (a > b > b) > b > Stream a > b # foldl :: (b > a > b) > b > Stream a > b # foldl' :: (b > a > b) > b > Stream a > b # foldr1 :: (a > a > a) > Stream a > a # foldl1 :: (a > a > a) > Stream a > a # elem :: Eq a => a > Stream a > Bool # maximum :: Ord a => Stream a > a # minimum :: Ord a => Stream a > a #  
Read a => Read (Stream a) Source #  signal 
Show a => Show (Stream a) Source #  signal 
Plottable a => Plot (Signal a) Source # 

Plottable a => Plot (Signal a) Source #  For plotting 
Plottable a => Plot (Signal a) Source #  For plotting 
(Plottable a, Show t, Real t, Fractional t, Num t, Ord t, Eq t) => Plot (SignalBase t a) Source #  For plotting 
Defined in ForSyDe.Atom.Utility.Plot sample :: Float > SignalBase t a > Samples Source # sample' :: SignalBase t a > Samples Source # takeUntil :: Float > SignalBase t a > SignalBase t a Source # getInfo :: SignalBase t a > PInfo Source #  
(Plottable a, Show t, Real t, Fractional t, Num t, Ord t, Eq t) => Plot (SignalBase t a) Source #  For plotting 
Defined in ForSyDe.Atom.Utility.Plot sample :: Float > SignalBase t a > Samples Source # sample' :: SignalBase t a > Samples Source # takeUntil :: Float > SignalBase t a > SignalBase t a Source # getInfo :: SignalBase t a > PInfo Source # 
fromStream :: Stream a > [a] Source #
The function fromStream
converts a signal into a list.
takeS :: (Num t, Ord t) => t > Stream e > Stream e Source #
Returns the first n
events in a signal.