úÎireŽ2      !"#$%&'()*+,-./01*5The possible structures of a node are defined by the  type. Note that the SNLx# nodes are only needed to optimise 4applicatives, they can all be expressed in terms of SNK and SNA. SNL5 f: liftA5 f SNL4 f: liftA4 f SNL3 f: liftA3 f SNL2 f: liftA2 f SNL1 f: fmap f SNKA s l: equivalent to s while aging signal l SND s: the s! signal delayed by one superstep SNR r*: opaque reference to connect peripherals  SNE s e ss: latcher that starts out as s and becomes the  current value of ss at every moment when e is true  SNA sf sx!: pointwise function application  SNT s x t1: stateful transfer function, which also depends  on an input signal s SNS x t: stateful generator, where x is current state and  t is the update function SNK x : constantly x ?A node can have four states that distinguish various stages of sampling and aging. Aged x s is the aged version of signal s paired with its  current value x  Sampled x s is signal s paired with its current value x  Sampling s is still s after its current value was $ requested, but still not delivered Ready s is simply the signal s that was not sampled yet A signal is represented as a  transactional structural node. BSinks are used when feeding input into peripheral-bound signals. %Time is continuous. Nothing fancy. BYou can uncomment the verbose version of this function to see the &applicative optimisations in action. BThis function is really just a shorthand to create a reference to a given node. CSampling 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, and the latcher also does its job 1here. 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 ( ) and latchers ( *) 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 @output, while latchers postpone the change and pass through the Gcurrent value of their current signal even if the latch control signal Eis true at the moment. Other types of signals are always handled by the ; function, so it is not possible to create a 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 !AA pure stateful signal. The initial state is the first output. initial state state transformation "=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 ##Reactive signal that starts out as s and can change its !behaviour to the one supplied in ss whenever e is true. The Dchange can be observed immediately, unless the signal is sampled by 6, which puts a delay on the latch control (but not on the latched signal!). s: initial behaviour e: latch control signal ss(: signal of potential future behaviours $<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 %The %8 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 &@Dependency injection to allow aging signals whose output is not >necessarily needed to produce the current sample of the first ,argument. It is more or less equivalent to  liftA2 const, the ?difference being that it evaluates its second argument first. the actual output 4a signal guaranteed to age when this one is sampled 2GThe equality test checks whether two signals are physically the same. 3The Show* instance is only defined for the sake of 4... 5The 6+ instance with run-time optimisation. The 7 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. '  !"#$%&'  !"#$%&'   !"#$%&89:;<=>?@ABCDEFGHIJK'ETraversing 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. ABecause of the fact that Elerea primitives are not referentially @transparent, the results might differ depending on whether this Cfunction is called before or after sampling (this also affects the ?actual network!), but the networks should be still equivalent. ''' (A short alternative name for &. )The )9 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. *%Point-wise equality of two signals. +'Point-wise inequality of two signals. ,'Point-wise comparison of two signals. -'Point-wise comparison of two signals. .'Point-wise comparison of two signals. /'Point-wise comparison of two signals. 0'Point-wise OR of two boolean signals. 1(Point-wise AND of two boolean signals.  !"#$%&()*+,-./01 &(!"#$%)*+,-./10 ()*+,-./01L      !"#$%&'()*+,-./0123456789:;8<=8<>?@ABCDEFGHIJKLMNOPQRS elerea-0.4.0FRP.Elerea.InternalFRP.Elerea.Graph FRP.Elerea SignalNodeSNL5SNL4SNL3SNL2SNL1SNKASNDSNRSNESNASNTSNSSNK SignalTransAgedSampledSamplingReadySignalSSinkDTimeTimedebugLog createSignal signalValueagecommitadvancesample sampleDelayed superstepstatefultransferlatcherexternaldelay keepAlive signalToDot.@.edge==@/=@<@<=@>=@>@||@&&@ $fEqSignal $fShowSignalbaseGHC.NumNum$fApplicativeSignalControl.Applicative Applicative<*> SignalInfoNoneLift5Lift4Lift3Lift2Lift1DelayExternalLatcherAppTransferStatefulConst SignalStoreIdgetPtr buildStore insertSignal nodeLabel