úΜ9˜3      !"#$%&'()*+,-./012(c) 2011 Brent YorgeyBSD-style (see LICENSE)byorgey@cis.upenn.eduNone -3457>CLN3"An abstract type for representing points in time6. Note that literal numeric values may be used as Times, thanks to the the 3 and 4 instances.An abstract type representing  elapsed timeo between two points in time. Note that durations can be negative. Literal numeric values may be used as Durations thanks to the 3 and 4 instances.EA convenient wrapper function to convert a numeric value into a time.DA convenient unwrapper function to turn a time into a numeric value.There are two types of Active values:An  can simply be a >, that is, a time-varying value with start and end times.An f value can also be a constant: a single value, constant across time, with no start and end times.'The addition of constant values enable 5 and 6 instances for .A  Dynamic a can be thought of as an a7 value that changes over the course of a particular  . It's envisioned that DynamicA will be mostly an internal implementation detail and that [ will be most commonly used. But you never know what uses people might find for things. An Erad is a concrete span of time, that is, a pair of times representing the start and end of the era. Era.s form a semigroup: the combination of two Eras is the smallest Era- which contains both. They do not form a 5, since there is no EraH which acts as the identity with respect to this combining operation.Era is abstract. To construct Era values, use  ; to deconstruct, use   and . IA convenient wrapper function to convert a numeric value into a duration. HA convenient unwrapper function to turn a duration into a numeric value.  Create an   by specifying start and end s. Get the start  of an  . Get the end  of an  . Compute the  of an  . Create a = from a start time, an end time, and a time-varying value. Fold for .Shift a  value by a certain duration.7 a is a 8 whenever a` is: the eras are combined according to their semigroup structure, and the values of type a$ are combined pointwise. Note that  a cannot be an instance of 5 since   is not.9 is an instance of : (i.e. 6 without ;­): a time-varying function is applied to a time-varying value pointwise; the era of the result is the combination of the function and value eras. Note, however, that  is not an instance of 6' since there is no way to implement ;Z: the era would have to be empty, but there is no such thing as an empty era (that is,   is not an instance of 5). Create an  value from a .Create a dynamic = from a start time, an end time, and a time-varying value. Fold for €s. Process an 'Active a', given a function to apply if it is a pure (constant) value, and a function to apply if it is a . Modify an I value using a case analysis to see whether it is constant or dynamic. Interpret an  value as a function from time.Get the value of an Active a at the beginning of its era.Get the value of an Active a at the end of its era.Get the   of an  value (or <$ if it is a constant/pure value).Test whether an  value is constant.Test whether an  value is .ui represents the  unit interval, which takes on the value t at time t, and has as its era [0,1]. It is equivalent to  0 1#, and can be visualized as follows: :diagrams/src_Data_Active_uiDia.svg#diagram=uiDia&width=200*On the x-axis is time, and the value that uib takes on is on the y-axis. The shaded portion represents the era. Note that the value of ui¼ (as with any active) is still defined outside its era, and this can make a difference when it is combined with other active values with different eras. Applying a function with =p affects all values, both inside and outside the era. To manipulate values outside the era specifically, see % and (. To alter the values that ui/ takes on without altering its era, use its > and 6 instances. For example,  (*2) <$> ui varies from 0 to 2 over the era [0,1]$. To alter the era, you can use  or ". interval a b% is an active value starting at time a, ending at time b, and taking the value t at time t. stretch s act "stretches" the active act so that it takes s/ times as long (retaining the same start time).  stretchTo d es an  so it has duration d. Has no effect if (1) d is non-positive, or (2) the " value is constant, or (3) the ] value has zero duration. [AJG: conditions (1) and (3) no longer true: to consider changing]!a1 `during` a2 es and "s a1# so that it has the same era as a2. Has no effect if either of a1 or a2 are constant." shift d act shifts the start time of act by duration d&. Has no effect on constant values.#hReverse an active value so the start of its era gets mapped to the end and vice versa. For example,  backwards  can be visualized as Hdiagrams/src_Data_Active_backwardsDia.svg#diagram=backwardsDia&width=200$\Take a "snapshot" of an active value at a particular time, resulting in a constant value.%]"Clamp" an active value so that it is constant before and after its era. Before the era, clamp a takes on the value of a7 at the start of the era. Likewise, after the era, clamp a takes on the value of a at the end of the era. clamp% has no effect on constant values. For example, clamp  can be visualized as @diagrams/src_Data_Active_clampDia.svg#diagram=clampDia&width=200 See also & and '<, which clamp only before or after the era, respectively.&\"Clamp" an active value so that it is constant before the start of its era. For example,  clampBefore  can be visualized as Ldiagrams/src_Data_Active_clampBeforeDia.svg#diagram=clampBeforeDia&width=200See the documentation of % for more information.'Z"Clamp" an active value so that it is constant after the end of its era. For example,  clampBefore  can be visualized as Jdiagrams/src_Data_Active_clampAfterDia.svg#diagram=clampAfterDia&width=200See the documentation of % for more information.(?"Trim" an active value so that it is empty outside its era. trim" has no effect on constant values. For example, trim  can be visualized as >diagrams/src_Data_Active_trimDia.svg#diagram=trimDia&width=200 Actually, trim ui7 is not well-typed, since it is not guaranteed that ui's values will be monoidal (and usually they won't be)! But the above image still provides a good intuitive idea of what trimD is doing. To make this precise we could consider something like trim (First . Just  $ ui). See also ) and  trimActive;, which trim only before or after the era, respectively.)+"Trim" an active value so that it is empty before' the start of its era. For example,  trimBefore  can be visualized as Jdiagrams/src_Data_Active_trimBeforeDia.svg#diagram=trimBeforeDia&width=200See the documentation of ( for more details.*+"Trim" an active value so that it is empty after& the end of its era. For example,  trimAfter  can be visualized as Hdiagrams/src_Data_Active_trimAfterDia.svg#diagram=trimAfterDia&width=200See the documentation of ( for more details.+Set the era of an 2 value. Note that this will change a constant I into a dynamic one which happens to have the same value at all times., atTime t a. is an active value with the same behavior as a', shifted so that it starts at time t. If a) is constant it is returned unchanged.- a1 `after` a2& produces an active that behaves like a1/ but is shifted to start at the end time of a2 . If either a1 or a2 are constant, a1 is returned unchanged..Sequence/overlay two I values: shift the second to start immediately after the first (using -), then compose them (using ?)./ "Splice" two R values together: shift the second to start immediately after the first (using -§), and produce the value which acts like the first up to the common end/start point, then like the second after that. If both are constant, return the first.0.Splice together a list of active values using / . The list must be nonempty.1 Create an ActiveH which takes on each value in the given list in turn during the time [0,1]G, with each value getting an equal amount of time. In other words, discrete¡ creates a "slide show" that starts at time 0 and ends at time 1. The first element is used prior to time 0, and the last element is used after time 1.It is an error to call discrete on the empty list.2simulate r act simulates the  value act˜, returning a list of "snapshots" taken at regular intervals from the start time to the end time. The interval used is determined by the rate rT, which denotes the "frame rate", that is, the number of snapshots per unit time.If the } value is constant (and thus has no start or end times), a list of length 1 is returned, containing the constant value.@!Active values over a type with a 8% instance are also an instance of 8d. Two active values are combined pointwise; the resulting value is constant iff both inputs are.FABCDEF G 79HIJKLMN !"#$%&'()*+,-./012O@P3  !"#$%&'()*+,-./0123 +, !"#$%&'()*-./012>ABCDEF G 79HIJKLMN !"#$%&'()*+,-./012O@P.Q      !"#$%&'()*+,-./012345647849:49;<=>?@ABC49D49E49F49G=>HIJKL MNOPQRSTUVactiv_8z6HF3xxmDXEYzPlHFGtrt Data.ActiveTimeDurationtoTimefromTimeActiveDynamicera runDynamicEra toDuration fromDurationmkErastartendduration mkDynamic onDynamic shiftDynamic fromDynamicmkActiveonActive modActive runActive activeStart activeEnd activeEra isConstant isDynamicuiintervalstretch stretchToduringshift backwardssnapshotclamp clampBefore clampAftertrim trimBefore trimAftersetEraatTimeafter->>|>>moviediscretesimulatebaseGHC.NumNumGHC.Real FractionalGHC.BaseMonoid Applicative$fSemigroupDynamicsemig_Iivsiy35cmk8ISqG11MEapData.Semigroup Semigroup$fApplyDynamicsemig_JeSkpeDtVR41uSBhabqvlyData.Functor.Bind.ClassApplypureNothingfmapFunctor<>$fSemigroupActiveunTime $fAffineTimeTFCo:R:UnwrappedTime$fMonoidDuration$fSemigroupDuration$fAdditiveDuration$fApplicativeDurationTFCo:R:UnwrappedDurationTFCo:R:UnwrappedActiveactive$fMonoidActiveTFCo:R:UnwrappedMaybeApply