u      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu@The phases every signal goes through during a superstep: before  or after sampling. vwx;A signal generator is the only source of stateful signals. D Internally, computes a signal structure and adds the new variables  to an existing update pool. yz{>A dynamic set of actions to update a network without breaking  consistency. 1A signal can be thought of as a function of type Nat -> a, and  its |6 instance agrees with that intuition. Internally, is ( represented by a sampling computation. }~Embedding a signal into an ! environment. Repeated calls to E the computation returned cause the whole network to be updated, and E the current sample of the top-level signal is produced as a result. E The computation accepts a global parameter that will be distributed A to all signals. For instance, this can be the time step, if we ( want to model continuous-time signals. &the generator of the top-level signal %the computation to sample the signal <Auxiliary function used by all the primitives that create a  mutable variable. sampling function aging function 'the mutable variable behind the signal the pool of update actions The 4 transfer function emits the value of a signal from E the previous superstep, starting with the filler value given in the  first argument. initial output the signal to delay :Memoising combinator. It can be used to cache results of B applicative combinators in case they are used in several places. & Other than that, it is equivalent to . signal to memoise >A reactive signal that takes the value to output from a monad D carried by its input. It is possible to create new signals in the  monad. *a stream of generators to potentially run <A signal that can be directly fed through the sink function @ returned. This can be used to attach the network to the outer E world. Note that this is optional, as all the input of the network B can be fed in through the global parameter, although that is not % really convenient for many signals. initial value )the signal and an IO function to feed it ?An event-like signal that can be fed through the sink function A returned. The signal carries a list of values fed in since the ' last sampling, i.e. it is constantly [] if the sink is never @ invoked. The order of elements is reversed, so the last value ? passed to the sink is the head of the list. Note that unlike  : this function only returns a generator to be used within < the expression constructing the top-level stream, and this " generator can only be used once. 9a generator for the event signal and the associated sink @A pure stateful signal. The initial state is the first output, D and every following output is calculated from the previous one and $ the value of the global parameter. =A stateful transfer function. The current input affects the D current output, i.e. the initial state given in the first argument C is considered to appear before the first output, and can never be B observed. Every output is derived from the current value of the B input signal, the global parameter and the previous output. The E only exception is when a transfer function sits in a loop without a B delay. In this case, a delay will be inserted at a single place D during runtime (i.e. the previous output of the node affected will 0 be reused) to resolve the circular dependency. A random signal. A random source within the  monad. A printing action within the  monad. 4Error message for unimplemented instance functions. Equality test is impossible. The Show* instance is only defined for the sake of ...     9The phases every signal goes through during a superstep. ?A signal generator is the only source of stateful signals. It ) can be thought of as a function of type Nat -> a , where the D result is an arbitrary data structure that can potentially contain A new signals, and the argument is the creation time of these new  signals. It exposes the  interface, which makes it 4 possible to define signals in terms of each other. >A dynamic set of actions to update a network without breaking  consistency. 1A signal can be thought of as a function of type Nat -> a, 2 where the argument is the sampling time, and the | instance ? agrees with the intuition (bind corresponds to extracting the  current sample). Embedding a signal into an ! environment. Repeated calls to E the computation returned cause the whole network to be updated, and = the current sample of the top-level signal is produced as a D result. This is the only way to extract a signal generator outside C the network, and it is equivalent to passing zero to the function  representing the generator. &the generator of the top-level signal %the computation to sample the signal <Auxiliary function used by all the primitives that create a  mutable variable. sampling function aging function 'the mutable variable behind the signal the pool of update actions the signal created The 4 transfer function emits the value of a signal from E the previous superstep, starting with the filler value given in the A first argument. It can be thought of as the following function : (which should also make it clear why the return value is   ):    delay x0 s t_start t_sample  | t_start == t_sample = x0  | t_start < t_sample = s (t_sample-1) " | otherwise = error "Premature sample!" CThe way signal generators are extracted ensures that the error can  never happen.  initial output at creation time the signal to delay the delayed signal ?A reactive signal that takes the value to output from a signal C generator carried by its input with the sampling time provided as B the time of generation. It is possible to create new signals in = the monad. It can be thought of as the following function:   5 generator g t_start t_sample = g t_sample t_sample It has to live in the   monad, because it needs to C maintain an internal state to be able to cache the current sample D for efficiency reasons. However, this state is not carried between ' samples, therefore starting time doesn't matter and can be ignored.  the signal of generators to run #the signal of generated structures =Override the clock used in a generator. Note that clocks don't E interact unless one is used in the definition of the other, i.e. it D is possible to provide a fast clock within a generator with a slow  associated clock. :Memoising combinator. It can be used to cache results of B applicative combinators in case they are used in several places. % It is observationally equivalent to  in the    monad. the signal to cache 4a signal observationally equivalent to the argument =A signal that is true exactly once: the first time the input C signal is true. Afterwards, it is constantly false, and it holds . no reference to the input signal. Note that  always follows D the master clock, i.e. the fastest one, therefore it never creates  a long spike of True. the boolean input signal =a one-shot signal true only the first time the input is true <A signal that can be directly fed through the sink function @ returned. This can be used to attach the network to the outer  world. initial value )the signal and an IO function to feed it ?An event-like signal that can be fed through the sink function A returned. The signal carries a list of values fed in since the ' last sampling, i.e. it is constantly [] if the sink is never @ invoked. The order of elements is reversed, so the last value ? passed to the sink is the head of the list. Note that unlike  : this function only returns a generator to be used within < the expression constructing the top-level stream, and this " generator can only be used once. 9a generator for the event signal and the associated sink @A pure stateful signal. The initial state is the first output, A and every subsequent state is derived from the preceding one by D applying a pure transformation. It is equivalent to the following  expression:   stateful x0 f =  $ sig ->  x0 (f  sig) initial state state transformation =A stateful transfer function. The current input affects the D current output, i.e. the initial state given in the first argument C is considered to appear before the first output, and can never be A observed, and subsequent states are determined by combining the C preceding state with the current output of the input signal using ; the function supplied. It is equivalent to the following  expression:   transfer x0 f s =  $ sig ->  f s   x0 sig initial internal state state updater function  input signal A random signal. A random source within the   monad. A printing action within the   monad.    @The phases every signal goes through during a superstep: before  or after sampling. ;A signal generator is the only source of stateful signals. D Internally, computes a signal structure and adds the new variables  to an existing update pool. >A dynamic set of actions to update a network without breaking  consistency. 1A signal can be thought of as a function of type Nat -> a, and  its |6 instance agrees with that intuition. Internally, is ( represented by a sampling computation. Embedding a signal into an ! environment. Repeated calls to E the computation returned cause the whole network to be updated, and = the current sample of the top-level signal is produced as a A result. The computation accepts a global parameter that will be A distributed to all signals. For instance, this can be the time 4 step, if we want to model continuous-time signals. &the generator of the top-level signal %the computation to sample the signal <Auxiliary function used by all the primitives that create a  mutable variable. sampling function aging function 'the mutable variable behind the signal the pool of update actions The 4 transfer function emits the value of a signal from E the previous superstep, starting with the filler value given in the  first argument. initial output the signal to delay :Memoising combinator. It can be used to cache results of : applicative combinators in case they are used in several . places. Other than that, it is equivalent to . signal to memoise !>A reactive signal that takes the value to output from a monad D carried by its input. It is possible to create new signals in the  monad. *a stream of generators to potentially run "=A signal that is true exactly once: the first time the input C signal is true. Afterwards, it is constantly false, and it holds # no reference to the input signal. the boolean input signal =a one-shot signal true only the first time the input is true #BThe common input signal that is fed through the function returned  by , unless we are in an $ded generator. $3Embed a generator with an overridden input signal. %<A signal that can be directly fed through the sink function @ returned. This can be used to attach the network to the outer E world. Note that this is optional, as all the input of the network B can be fed in through the global parameter, although that is not % really convenient for many signals. initial value )the signal and an IO function to feed it &?An event-like signal that can be fed through the sink function A returned. The signal carries a list of values fed in since the ' last sampling, i.e. it is constantly [] if the sink is never @ invoked. The order of elements is reversed, so the last value ? passed to the sink is the head of the list. Note that unlike  %: this function only returns a generator to be used within < the expression constructing the top-level stream, and this " generator can only be used once. 9a generator for the event signal and the associated sink '@A pure stateful signal. The initial state is the first output, D and every following output is calculated from the previous one and E the value of the global parameter (which might have been overridden  by $2). It is equivalent to the following expression:   stateful x0 f =  $ sig -> # >>= i ->  x0 (f  i  sig) initial state state transformation (=A stateful transfer function. The current input affects the D current output, i.e. the initial state given in the first argument C is considered to appear before the first output, and can never be B observed. Every output is derived from the current value of the ; input signal, the global parameter (which might have been  overridden by $-) and the previous output. It is equivalent  to the following expression:   transfer x0 f s =  $ sig -> # >>= i ->  f i s   x0 sig initial internal state state updater function  input signal )A random signal. *A random source within the  monad. +A printing action within the  monad. 4Error message for unimplemented instance functions. Equality test is impossible. The Show* instance is only defined for the sake of ...  !"#$%&'()*+%&! "#$'()*+ !"#$%&'()*+9The phases every signal goes through during a superstep. ,?A signal generator is the only source of stateful signals. It ) can be thought of as a function of type Nat -> a , where the D result is an arbitrary data structure that can potentially contain A new signals, and the argument is the creation time of these new  signals. It exposes the  interface, which makes it 4 possible to define signals in terms of each other. >A dynamic set of actions to update a network without breaking  consistency. -1A signal can be thought of as a function of type Nat -> a, 2 where the argument is the sampling time, and the | instance ? agrees with the intuition (bind corresponds to extracting the  current sample). .Embedding a signal into an ! environment. Repeated calls to E the computation returned cause the whole network to be updated, and = the current sample of the top-level signal is produced as a D result. This is the only way to extract a signal generator outside C the network, and it is equivalent to passing zero to the function  representing the generator. &the generator of the top-level signal %the computation to sample the signal <Auxiliary function used by all the primitives that create a  mutable variable. sampling function aging function 'the mutable variable behind the signal the pool of update actions the signal created /The /4 transfer function emits the value of a signal from E the previous superstep, starting with the filler value given in the A first argument. It can be thought of as the following function : (which should also make it clear why the return value is  ,):    delay x0 s t_start t_sample  | t_start == t_sample = x0  | t_start < t_sample = s (t_sample-1) " | otherwise = error "Premature sample!" CThe way signal generators are extracted ensures that the error can  never happen.  initial output at creation time the signal to delay the delayed signal 0?A reactive signal that takes the value to output from a signal C generator carried by its input with the sampling time provided as B the time of generation. It is possible to create new signals in = the monad. It can be thought of as the following function:   5 generator g t_start t_sample = g t_sample t_sample It has to live in the , monad, because it needs to C maintain an internal state to be able to cache the current sample D for efficiency reasons. However, this state is not carried between ' samples, therefore starting time doesn't matter and can be ignored.  the signal of generators to run #the signal of generated structures 1:Memoising combinator. It can be used to cache results of B applicative combinators in case they are used in several places. % It is observationally equivalent to  in the ,  monad. the signal to cache 4a signal observationally equivalent to the argument 2=A signal that is true exactly once: the first time the input C signal is true. Afterwards, it is constantly false, and it holds E no reference to the input signal. It is observationally equivalent 4 to the following expression (which would hold onto s forever):   until s = do  step <- 6 False (||) s  dstep <- / False step  return $  (/=) step dstep the boolean input signal =a one-shot signal true only the first time the input is true 3<A signal that can be directly fed through the sink function @ returned. This can be used to attach the network to the outer  world. initial value )the signal and an IO function to feed it 4?An event-like signal that can be fed through the sink function A returned. The signal carries a list of values fed in since the ' last sampling, i.e. it is constantly [] if the sink is never @ invoked. The order of elements is reversed, so the last value ? passed to the sink is the head of the list. Note that unlike  3: this function only returns a generator to be used within < the expression constructing the top-level stream, and this " generator can only be used once. 9a generator for the event signal and the associated sink 5@A pure stateful signal. The initial state is the first output, A and every subsequent state is derived from the preceding one by D applying a pure transformation. It is equivalent to the following  expression:   stateful x0 f =  $ sig -> / x0 (f  sig) initial state state transformation 6=A stateful transfer function. The current input affects the D current output, i.e. the initial state given in the first argument C is considered to appear before the first output, and can never be A observed, and subsequent states are determined by combining the C preceding state with the current output of the input signal using ; the function supplied. It is equivalent to the following  expression:   transfer x0 f s =  $ sig ->  f s  / x0 sig initial internal state state updater function  input signal 7A random signal. 8A random source within the , monad. 9A printing action within the , monad. ,-./0123456789-,.34/01256789,-./01234567892:5The possible structures of a node are defined by the : type. Note that the SNFx# nodes are only needed to optimise 4applicatives, they can all be expressed in terms of SNK and SNA. ;SNF5 f: liftA5 f <SNF4 f: liftA4 f =SNF3 f: liftA3 f >SNF2 f: liftA2 f ?SNF1 f: fmap f @SNKA s l: equivalent to s while aging signal l ASND s: the s! signal delayed by one superstep BSNE r*: opaque reference to connect peripherals CSNM b sm3: signal generator that executes the monad carried  by sm whenever b% is true, and outputs the result (or  undefined when b is false) DSNH ss r: the higher-order signal ss collapsed into a  signal cached in reference r; r is used during the aging  phase E SNA sf sx!: pointwise function application F SNT s x t1: stateful transfer function, which also depends  on an input signal s GSNS x t: stateful generator, where x is current state and  t is the update function HSNK x : constantly x I?A node can have four states that distinguish various stages of sampling and aging. JAged x s is the aged version of signal s paired with its  current value x K Sampled x s is signal s paired with its current value x L Sampling s is signal s after its current value was " requested, but not yet delivered MReady s is simply the signal s that was not sampled yet N0A signal is conceptually a time-varying value. OP3A restricted monad to create stateful signals in. QRSBSinks are used when feeding input into peripheral-bound signals. T%Time is continuous. Nothing fancy. U,A printing function that can be used in the P. "Provided for debugging purposes. VBYou can uncomment the verbose version of this function to see the &applicative optimisations in action. W5Error message for unimplemented instance functions. X Creating a reference within the P. Used for stateful  signals. Y:Creating a reference as a pure value. Used for stateless  signals. ZCSampling the signal and all of its dependencies, at the same time. We don':t need the aged signal in the current superstep, only the Bcurrent value, so we sample before propagating the changes, which Bmight require the fresh sample because of recursive definitions. [;Aging the network of signals the given signal depends on. \-Finalising aged signals for the next round. ]?Aging the signal. Stateful signals have their state forced to Bprevent building up big thunks. The other nodes are structurally  static. ^ASampling the signal at the current moment. This is where static Enodes propagate changes to those they depend on. Transfer functions (F>) work without delay, i.e. the effects of their input signals (can be observed in the same superstep. _@Sampling the signal with some kind of delay in order to resolve Cdependency loops. Transfer functions simply return their previous Eoutput (delays can be considered a special case, because they always  do that, so _) is never called with them), while other +types of signals are always handled by the ^ function, so it is Bnot possible to create a working stateful loop composed of solely stateless combinators. `@Advancing the whole network that the given signal depends on by 2the amount of time given in the second argument. the top-level signal the amount of time to advance  the current value of the signal aAA pure stateful signal. The initial state is the first output. initial state state transformation b=A stateful transfer function. The current input affects the Fcurrent output, i.e. the initial state given in the first argument is Gconsidered to appear before the first output, and can only be directly observed by the _ function. initial internal state state updater function  input signal c<A continuous sampler that flattens a higher-order signal by #outputting its current snapshots. signal to flatten d>A reactive signal that takes the value to output from a monad Fcarried by its input when a boolean control signal is true, otherwise  it outputs /. It is possible to create new signals in the )monad and also to print debug messages. control (trigger) signal &a stream of monads to potentially run e)A helper function to wrap any value in a  depending on a boolean condition. f<A signal that can be directly fed through the sink function ?returned. This can be used to attach the network to the outer world. initial value )the signal and an IO function to feed it gThe g8 transfer function emits the value of a signal from the Fprevious superstep, starting with the filler value given in the first Gargument. It has to be a primitive, otherwise it could not be used to prevent automatic delays. initial output the signal to delay h@Dependency injection to allow aging signals whose output is not >necessarily needed to produce the current sample of the first  argument. It's equivalent to (flip . liftA2 . flip) const, as it &evaluates its second argument first. the actual output 4a signal guaranteed to age when this one is sampled GThe equality test checks whether two signals are physically the same. The Show* instance is only defined for the sake of ... The + instance with run-time optimisation. The  Goperator tries to move all the pure parts to its left side in order to Hflatten the structure, hence cutting down on book-keeping costs. Since Dapplicatives are used with pure functions and lifted values most of 6the time, one can gain a lot by merging these nodes. /:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh/TSPQRUNOIMLKJ:HGFEDCBA@?>=<;VWXYZ[\]^_`abcdefgh/:HGFEDCBA@?>=<;;<=>?@ABCDEFGHIMLKJJKLMNOOPQRQRSTUVWXYZ[\]^_`abcdefghiETraversing the network starting from the given signal and converting 2it into a string containing the graph in Graphviz ( http://www.graphviz.org/+) dot format. Stateful nodes are coloured according to their type. FThe results might differ depending on whether this function is called Fbefore or after sampling (this also affects the actual network!), but )the networks should be still equivalent. iii jA short alternative name for h. kThe k9 transfer function takes a bool signal and emits another Fbool signal that turns true only at the moment when there is a rising edge on the input. lThe l+ transfer function behaves as a latch on a  ,input: it keeps its state when the input is , and replaces it with the input otherwise. Initial output Maybe signal to latch on m%Point-wise equality of two signals. n'Point-wise inequality of two signals. o'Point-wise comparison of two signals. p'Point-wise comparison of two signals. q'Point-wise comparison of two signals. r'Point-wise comparison of two signals. s'Point-wise OR of two boolean signals. t(Point-wise AND of two boolean signals. NPRSTU`abcdefghjklmnopqrstTSNPRR`fabgcdlekhjmnopqrtsU jklmnopqrst                     !"#$%&'()*+, -./0123456789:;<=>? @ ABCDEFGHIJKLMN)+,OPQRST-UVWXYRSZ5[\R]^N_,R`aOPQ-YR`bRcdRef5N),OPQ-YRegReh5[\N_,OPQ-Y5RijRik[\lRemnopqrstuvwxyz{|}~ elerea-2.1.0FRP.Elerea.DelayedFRP.Elerea.ClockedFRP.Elerea.ParamFRP.Elerea.SimpleFRP.Elerea.Legacy.InternalFRP.Elerea.Legacy.GraphFRP.Elerea.Legacy SignalGenSignalstartdelaymemo generatorexternal externalMultistatefultransfernoise getRandomdebug withClockuntilinputembed SignalNodeSNF5SNF4SNF3SNF2SNF1SNKASNDSNESNMSNHSNASNTSNSSNK SignalTransAgedSampledSamplingReadyS SignalMonadSM createSignalSinkDTime signalDebugdebugLogunimp makeSignalmakeSignalUnsafe signalValueagecommitadvancesample sampleDelayed superstepsamplertoMaybe keepAlive signalToDot.@.edge storeJust==@/=@<@<=@>=@>@||@&&@PhaseSGunSG UpdatePoolbaseGHC.BaseMonadunSghc-prim GHC.TypesIO addSignalreturn $fEqSignal $fShowSignalGHC.NumNumUpdatedControl.Monad.FixMonadFixmfix Data.Functor<$>Control.ApplicativeliftA2<*>liftA3 Data.MaybeNothingMaybe$fApplicativeSignal Applicative SignalInfoNoneLift5Lift4Lift3Lift2Lift1DelayExternal GeneratorSamplerAppTransferStatefulConst SignalStoreIdgetPtr buildStore insertSignal nodeLabel