This file is indexed.

/usr/share/doc/libghc-active-doc/html/Data-Active.html is in libghc-active-doc 0.2.0.8-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Active</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Active.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Active.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">active-0.2.0.8: Abstractions for animation</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) 2011 Brent Yorgey</td></tr><tr><th>License</th><td>BSD-style (see LICENSE)</td></tr><tr><th>Maintainer</th><td>byorgey@cis.upenn.edu</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Data.Active</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Representing time</a><ul><li><a href="#g:2">Time and duration</a></li><li><a href="#g:3">Eras</a></li></ul></li><li><a href="#g:4">Dynamic values</a></li><li><a href="#g:5">Active values</a></li><li><a href="#g:6">Combinators</a><ul><li><a href="#g:7">Special active values</a></li><li><a href="#g:8">Transforming active values</a></li><li><a href="#g:9">Working with values outside the era</a></li><li><a href="#g:10">Composing active values</a></li></ul></li><li><a href="#g:11">Discretization</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Inspired by the work of Kevin Matlage and Andy Gill (<em>Every</em>
 <em>Animation Should Have a Beginning, a Middle, and an End</em>, Trends
 in Functional Programming,
 2010. <a href="http://ittc.ku.edu/csdl/fpg/node/46">http://ittc.ku.edu/csdl/fpg/node/46</a>), this module defines a
 simple abstraction for working with time-varying values.  A value
 of type <code>Active a</code> is either a constant value of type <code>a</code>, or a
 time-varying value of type <code>a</code> (<em>i.e.</em> a function from time to
 <code>a</code>) with specific start and end times.  Since active values
 have start and end times, they can be aligned, sequenced,
 stretched, or reversed.</p><p>In a sense, this is sort of like a stripped-down version of
 functional reactive programming (FRP), without the reactivity.</p><p>The original motivating use for this library is to support making
 animations with the diagrams framework
 (<a href="http://projects.haskell.org/diagrams">http://projects.haskell.org/diagrams</a>), but the hope is that it
 may find more general utility.</p><p>There are two basic ways to create an <code>Active</code> value.  The first is
 to use <code><a href="Data-Active.html#v:mkActive">mkActive</a></code> to create one directly, by specifying a start and
 end time and a function of time.  More indirectly, one can use the
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> instance together with the unit interval <code><a href="Data-Active.html#v:ui">ui</a></code>, which
 takes on values from the unit interval from time 0 to time 1, or
 <code><a href="Data-Active.html#v:interval">interval</a></code>, which creates an active over an arbitrary interval.</p><p>For example, to create a value of type <code>Active Double</code> which
 represents one period of a sine wave starting at time 0 and ending
 at time 1, we could write</p><pre>mkActive 0 1 (\t -&gt; sin (fromTime t * tau))</pre><p>or</p><pre>(sin . (*tau)) &lt;$&gt; ui</pre><p><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#v:pure">pure</a></code> can also be used to create <code>Active</code> values which are
 constant and have no start or end time.  For example,</p><pre>mod &lt;$&gt; (floor &lt;$&gt; interval 0 100) &lt;*&gt; pure 7</pre><p>cycles repeatedly through the numbers 0-6.</p><p>Note that the &quot;idiom bracket&quot; notation supported by the SHE
 preprocessor (<a href="http://personal.cis.strath.ac.uk/~conor/pub/she/">http://personal.cis.strath.ac.uk/~conor/pub/she/</a>,
 <a href="http://hackage.haskell.org/package/she">http://hackage.haskell.org/package/she</a>) can make for somewhat
 more readable <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> code.  For example, the above example
 can be rewritten using SHE as</p><pre>{-# OPTIONS_GHC -F -pgmF she #-}

... (| mod (| floor (interval 0 100) |) ~7 |)</pre><p>There are many functions for transforming and composing active
 values; see the documentation below for more details.</p><p>With careful handling, this module should be suitable to generating
 deep embeddings if <code><a href="Data-Active.html#t:Active">Active</a></code> values.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Time">Time</a> n</li><li class="src short"><a href="#v:toTime">toTime</a> :: n -&gt; <a href="Data-Active.html#t:Time">Time</a> n</li><li class="src short"><a href="#v:fromTime">fromTime</a> :: <a href="Data-Active.html#t:Time">Time</a> n -&gt; n</li><li class="src short"><span class="keyword">data</span> <a href="#t:Duration">Duration</a> n</li><li class="src short"><a href="#v:toDuration">toDuration</a> :: n -&gt; <a href="Data-Active.html#t:Duration">Duration</a> n</li><li class="src short"><a href="#v:fromDuration">fromDuration</a> :: <a href="Data-Active.html#t:Duration">Duration</a> n -&gt; n</li><li class="src short"><span class="keyword">data</span> <a href="#t:Era">Era</a> n</li><li class="src short"><a href="#v:mkEra">mkEra</a> :: <a href="Data-Active.html#t:Time">Time</a> n -&gt; <a href="Data-Active.html#t:Time">Time</a> n -&gt; <a href="Data-Active.html#t:Era">Era</a> n</li><li class="src short"><a href="#v:start">start</a> :: <a href="Data-Active.html#t:Era">Era</a> n -&gt; <a href="Data-Active.html#t:Time">Time</a> n</li><li class="src short"><a href="#v:end">end</a> :: <a href="Data-Active.html#t:Era">Era</a> n -&gt; <a href="Data-Active.html#t:Time">Time</a> n</li><li class="src short"><a href="#v:duration">duration</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> n =&gt; <a href="Data-Active.html#t:Era">Era</a> n -&gt; <a href="Data-Active.html#t:Duration">Duration</a> n</li><li class="src short"><span class="keyword">data</span> <a href="#t:Dynamic">Dynamic</a> a = <a href="#v:Dynamic">Dynamic</a> {<ul class="subs"><li><a href="#v:era">era</a> :: <a href="Data-Active.html#t:Era">Era</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a></li><li><a href="#v:runDynamic">runDynamic</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a</li></ul>}</li><li class="src short"><a href="#v:mkDynamic">mkDynamic</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a) -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a</li><li class="src short"><a href="#v:onDynamic">onDynamic</a> :: (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a) -&gt; b) -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; b</li><li class="src short"><a href="#v:shiftDynamic">shiftDynamic</a> :: <a href="Data-Active.html#t:Duration">Duration</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a</li><li class="src short"><span class="keyword">data</span> <a href="#t:Active">Active</a> a</li><li class="src short"><a href="#v:mkActive">mkActive</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a) -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:fromDynamic">fromDynamic</a> :: <a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:isConstant">isConstant</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isDynamic">isDynamic</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:onActive">onActive</a> :: (a -&gt; b) -&gt; (<a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; b) -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; b</li><li class="src short"><a href="#v:modActive">modActive</a> :: (a -&gt; b) -&gt; (<a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> b) -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> b</li><li class="src short"><a href="#v:runActive">runActive</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a</li><li class="src short"><a href="#v:activeEra">activeEra</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Active.html#t:Era">Era</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a>)</li><li class="src short"><a href="#v:setEra">setEra</a> :: <a href="Data-Active.html#t:Era">Era</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:atTime">atTime</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:activeStart">activeStart</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; a</li><li class="src short"><a href="#v:activeEnd">activeEnd</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; a</li><li class="src short"><a href="#v:ui">ui</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:interval">interval</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> a =&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:stretch">stretch</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:stretchTo">stretchTo</a> :: <a href="Data-Active.html#t:Duration">Duration</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:during">during</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:shift">shift</a> :: <a href="Data-Active.html#t:Duration">Duration</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:backwards">backwards</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:snapshot">snapshot</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:clamp">clamp</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:clampBefore">clampBefore</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:clampAfter">clampAfter</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:trim">trim</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:trimBefore">trimBefore</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:trimAfter">trimAfter</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:after">after</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:-45--62--62-">(-&gt;&gt;)</a> :: <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:-124--62--62-">(|&gt;&gt;)</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:movie">movie</a> :: [<a href="Data-Active.html#t:Active">Active</a> a] -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:discrete">discrete</a> :: [a] -&gt; <a href="Data-Active.html#t:Active">Active</a> a</li><li class="src short"><a href="#v:simulate">simulate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; [a]</li></ul></div><div id="interface"><h1 id="g:1">Representing time</h1><h2 id="g:2">Time and duration</h2><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Time" class="def">Time</a> n <a href="src/Data-Active.html#Time" class="link">Source</a></p><div class="doc"><p>An abstract type for representing <em>points in time</em>.  Note that
   literal numeric values may be used as <code>Time</code>s, thanks to the the
   <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a></code> instances.</p></div><div class="subs instances"><p id="control.i:Time" class="caption collapser" onclick="toggleSection('i:Time')">Instances</p><div id="section.i:Time" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> <a href="Data-Active.html#t:Time">Time</a></span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-linear-doc/html/Linear-Affine.html#t:Affine">Affine</a> <a href="Data-Active.html#t:Time">Time</a></span> <a href="src/Data-Active.html#line-182" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Enum">Enum</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Enum">Enum</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Real">Real</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Real">Real</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:RealFrac">RealFrac</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:RealFrac">RealFrac</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-170" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Wrapped">Wrapped</a> (<a href="Data-Active.html#t:Time">Time</a> n)</span> <a href="src/Data-Active.html#line-172" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(~) * (<a href="Data-Active.html#t:Time">Time</a> n1) t0 =&gt; <a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Rewrapped">Rewrapped</a> (<a href="Data-Active.html#t:Time">Time</a> n) t</span> <a href="src/Data-Active.html#line-172" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-linear-doc/html/Linear-Affine.html#t:Diff">Diff</a> <a href="Data-Active.html#t:Time">Time</a> = <a href="Data-Active.html#t:Duration">Duration</a></span> <a href="src/Data-Active.html#line-183" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Unwrapped">Unwrapped</a> (<a href="Data-Active.html#t:Time">Time</a> n0) = n0</span> <a href="src/Data-Active.html#line-172" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:toTime" class="def">toTime</a> :: n -&gt; <a href="Data-Active.html#t:Time">Time</a> n <a href="src/Data-Active.html#toTime" class="link">Source</a></p><div class="doc"><p>A convenient wrapper function to convert a numeric value into a time.</p></div></div><div class="top"><p class="src"><a name="v:fromTime" class="def">fromTime</a> :: <a href="Data-Active.html#t:Time">Time</a> n -&gt; n <a href="src/Data-Active.html#fromTime" class="link">Source</a></p><div class="doc"><p>A convenient unwrapper function to turn a time into a numeric value.</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Duration" class="def">Duration</a> n <a href="src/Data-Active.html#Duration" class="link">Source</a></p><div class="doc"><p>An abstract type representing <em>elapsed time</em> between two points
   in time.  Note that durations can be negative. Literal numeric
   values may be used as <code>Duration</code>s thanks to the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a></code> and
   <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a></code> instances.</p></div><div class="subs instances"><p id="control.i:Duration" class="caption collapser" onclick="toggleSection('i:Duration')">Instances</p><div id="section.i:Duration" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> <a href="Data-Active.html#t:Duration">Duration</a></span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> <a href="Data-Active.html#t:Duration">Duration</a></span> <a href="src/Data-Active.html#line-208" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-linear-doc/html/Linear-Vector.html#t:Additive">Additive</a> <a href="Data-Active.html#t:Duration">Duration</a></span> <a href="src/Data-Active.html#line-212" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Enum">Enum</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Enum">Enum</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Real">Real</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Real">Real</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:RealFrac">RealFrac</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:RealFrac">RealFrac</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-196" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-218" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> n =&gt; <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-215" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Wrapped">Wrapped</a> (<a href="Data-Active.html#t:Duration">Duration</a> n)</span> <a href="src/Data-Active.html#line-198" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(~) * (<a href="Data-Active.html#t:Duration">Duration</a> n1) t0 =&gt; <a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Rewrapped">Rewrapped</a> (<a href="Data-Active.html#t:Duration">Duration</a> n) t</span> <a href="src/Data-Active.html#line-198" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Unwrapped">Unwrapped</a> (<a href="Data-Active.html#t:Duration">Duration</a> n0) = n0</span> <a href="src/Data-Active.html#line-198" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:toDuration" class="def">toDuration</a> :: n -&gt; <a href="Data-Active.html#t:Duration">Duration</a> n <a href="src/Data-Active.html#toDuration" class="link">Source</a></p><div class="doc"><p>A convenient wrapper function to convert a numeric value into a duration.</p></div></div><div class="top"><p class="src"><a name="v:fromDuration" class="def">fromDuration</a> :: <a href="Data-Active.html#t:Duration">Duration</a> n -&gt; n <a href="src/Data-Active.html#fromDuration" class="link">Source</a></p><div class="doc"><p>A convenient unwrapper function to turn a duration into a numeric value.</p></div></div><h2 id="g:3">Eras</h2><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Era" class="def">Era</a> n <a href="src/Data-Active.html#Era" class="link">Source</a></p><div class="doc"><p>An <code>Era</code> is a concrete span of time, that is, a pair of times
   representing the start and end of the era. <code>Era</code>s form a
   semigroup: the combination of two <code>Era</code>s is the smallest <code>Era</code>
   which contains both.  They do not form a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a></code>, since there is
   no <code>Era</code> which acts as the identity with respect to this
   combining operation.</p><p><code>Era</code> is abstract. To construct <code>Era</code> values, use <code><a href="Data-Active.html#v:mkEra">mkEra</a></code>; to
   deconstruct, use <code><a href="Data-Active.html#v:start">start</a></code> and <code><a href="Data-Active.html#v:end">end</a></code>.</p></div><div class="subs instances"><p id="control.i:Era" class="caption collapser" onclick="toggleSection('i:Era')">Instances</p><div id="section.i:Era" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> n =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Data-Active.html#t:Era">Era</a> n)</span> <a href="src/Data-Active.html#line-232" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> n =&gt; <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> (<a href="Data-Active.html#t:Era">Era</a> n)</span> <a href="src/Data-Active.html#line-232" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:mkEra" class="def">mkEra</a> :: <a href="Data-Active.html#t:Time">Time</a> n -&gt; <a href="Data-Active.html#t:Time">Time</a> n -&gt; <a href="Data-Active.html#t:Era">Era</a> n <a href="src/Data-Active.html#mkEra" class="link">Source</a></p><div class="doc"><p>Create an <code><a href="Data-Active.html#t:Era">Era</a></code> by specifying start and end <code><a href="Data-Active.html#t:Time">Time</a></code>s.</p></div></div><div class="top"><p class="src"><a name="v:start" class="def">start</a> :: <a href="Data-Active.html#t:Era">Era</a> n -&gt; <a href="Data-Active.html#t:Time">Time</a> n <a href="src/Data-Active.html#start" class="link">Source</a></p><div class="doc"><p>Get the start <code><a href="Data-Active.html#t:Time">Time</a></code> of an <code><a href="Data-Active.html#t:Era">Era</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:end" class="def">end</a> :: <a href="Data-Active.html#t:Era">Era</a> n -&gt; <a href="Data-Active.html#t:Time">Time</a> n <a href="src/Data-Active.html#end" class="link">Source</a></p><div class="doc"><p>Get the end <code><a href="Data-Active.html#t:Time">Time</a></code> of an <code><a href="Data-Active.html#t:Era">Era</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:duration" class="def">duration</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Num">Num</a> n =&gt; <a href="Data-Active.html#t:Era">Era</a> n -&gt; <a href="Data-Active.html#t:Duration">Duration</a> n <a href="src/Data-Active.html#duration" class="link">Source</a></p><div class="doc"><p>Compute the <code><a href="Data-Active.html#t:Duration">Duration</a></code> of an <code><a href="Data-Active.html#t:Era">Era</a></code>.</p></div></div><h1 id="g:4">Dynamic values</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Dynamic" class="def">Dynamic</a> a <a href="src/Data-Active.html#Dynamic" class="link">Source</a></p><div class="doc"><p>A <code>Dynamic a</code> can be thought of as an <code>a</code> value that changes over
   the course of a particular <code><a href="Data-Active.html#t:Era">Era</a></code>.  It's envisioned that <code>Dynamic</code>
   will be mostly an internal implementation detail and that
   <code><a href="Data-Active.html#t:Active">Active</a></code> will be most commonly used.  But you never know what
   uses people might find for things.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Dynamic" class="def">Dynamic</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:era" class="def">era</a> :: <a href="Data-Active.html#t:Era">Era</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:runDynamic" class="def">runDynamic</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a</dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:Dynamic" class="caption collapser" onclick="toggleSection('i:Dynamic')">Instances</p><div id="section.i:Dynamic" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> <a href="Data-Active.html#t:Dynamic">Dynamic</a></span> <a href="src/Data-Active.html#line-264" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Apply.html#t:Apply">Apply</a> <a href="Data-Active.html#t:Dynamic">Dynamic</a></span> <a href="src/Data-Active.html#line-275" class="link">Source</a></td><td class="doc"><p><code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> is an instance of <code><a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Apply.html#t:Apply">Apply</a></code> (<em>i.e.</em> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> without
   <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#v:pure">pure</a></code>): 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 <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> is <em>not</em>
   an instance of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> since there is no way to implement
   <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#v:pure">pure</a></code>: the era would have to be empty, but there is no such
   thing as an empty era (that is, <code><a href="Data-Active.html#t:Era">Era</a></code> is not an instance of
   <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a></code>).</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> a =&gt; <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> (<a href="Data-Active.html#t:Dynamic">Dynamic</a> a)</span> <a href="src/Data-Active.html#line-282" class="link">Source</a></td><td class="doc"><p><code><code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> a</code> is a <code><a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a></code> whenever <code>a</code> is: the eras are
   combined according to their semigroup structure, and the values
   of type <code>a</code> are combined pointwise.  Note that <code><code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> a</code> cannot
   be an instance of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a></code> since <code><a href="Data-Active.html#t:Era">Era</a></code> is not.</p></td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:mkDynamic" class="def">mkDynamic</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a) -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a <a href="src/Data-Active.html#mkDynamic" class="link">Source</a></p><div class="doc"><p>Create a <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> from a start time, an end time, and a
   time-varying value.</p></div></div><div class="top"><p class="src"><a name="v:onDynamic" class="def">onDynamic</a> :: (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a) -&gt; b) -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; b <a href="src/Data-Active.html#onDynamic" class="link">Source</a></p><div class="doc"><p>Fold for <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:shiftDynamic" class="def">shiftDynamic</a> :: <a href="Data-Active.html#t:Duration">Duration</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> a <a href="src/Data-Active.html#shiftDynamic" class="link">Source</a></p><div class="doc"><p>Shift a <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> value by a certain duration.</p></div></div><h1 id="g:5">Active values</h1><div class="doc"><p>For working with time-varying values, it is convenient to have an
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> instance: <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#v:-60--42--62-">&lt;*&gt;</a></code> lets us apply time-varying
 functions to time-varying values; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#v:pure">pure</a></code> allows treating constants
 as time-varying values which do not vary.  However, as explained in
 its documentation, <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> cannot be made an instance of
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> since there is no way to implement <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#v:pure">pure</a></code>.  The
 problem is that all <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code> values must have a finite start and
 end time.  The solution is to adjoin a special constructor for
 pure/constant values with no start or end time, giving us <code><a href="Data-Active.html#t:Active">Active</a></code>.</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Active" class="def">Active</a> a <a href="src/Data-Active.html#Active" class="link">Source</a></p><div class="doc"><p>There are two types of <code>Active</code> values:</p><ul><li>An <code><a href="Data-Active.html#t:Active">Active</a></code> can simply be a <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code>, that is, a time-varying
     value with start and end times.</li><li>An <code><a href="Data-Active.html#t:Active">Active</a></code> value can also be a constant: a single value,
     constant across time, with no start and end times.</li></ul><p>The addition of constant values enable <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code>
   instances for <code><a href="Data-Active.html#t:Active">Active</a></code>.</p></div><div class="subs instances"><p id="control.i:Active" class="caption collapser" onclick="toggleSection('i:Active')">Instances</p><div id="section.i:Active" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> <a href="Data-Active.html#t:Active">Active</a></span> <a href="src/Data-Active.html#line-329" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> <a href="Data-Active.html#t:Active">Active</a></span> <a href="src/Data-Active.html#line-329" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Apply.html#t:Apply">Apply</a> <a href="Data-Active.html#t:Active">Active</a></span> <a href="src/Data-Active.html#line-329" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a, <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> a) =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> (<a href="Data-Active.html#t:Active">Active</a> a)</span> <a href="src/Data-Active.html#line-355" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> a =&gt; <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> (<a href="Data-Active.html#t:Active">Active</a> a)</span> <a href="src/Data-Active.html#line-340" class="link">Source</a></td><td class="doc"><p>Active values over a type with a <code><a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a></code> instance are also an
   instance of <code><a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a></code>.  Two active values are combined
   pointwise; the resulting value is constant iff both inputs are.</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Wrapped">Wrapped</a> (<a href="Data-Active.html#t:Active">Active</a> a)</span> <a href="src/Data-Active.html#line-331" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(~) * (<a href="Data-Active.html#t:Active">Active</a> a1) t0 =&gt; <a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Rewrapped">Rewrapped</a> (<a href="Data-Active.html#t:Active">Active</a> a) t</span> <a href="src/Data-Active.html#line-331" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-lens-doc/html/Control-Lens-Wrapped.html#t:Unwrapped">Unwrapped</a> (<a href="Data-Active.html#t:Active">Active</a> a0) = <a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Apply.html#t:MaybeApply">MaybeApply</a> <a href="Data-Active.html#t:Dynamic">Dynamic</a> a0</span> <a href="src/Data-Active.html#line-331" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:mkActive" class="def">mkActive</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; (<a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a) -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#mkActive" class="link">Source</a></p><div class="doc"><p>Create a dynamic <code><a href="Data-Active.html#t:Active">Active</a></code> from a start time, an end time, and a
   time-varying value.</p></div></div><div class="top"><p class="src"><a name="v:fromDynamic" class="def">fromDynamic</a> :: <a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#fromDynamic" class="link">Source</a></p><div class="doc"><p>Create an <code><a href="Data-Active.html#t:Active">Active</a></code> value from a <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:isConstant" class="def">isConstant</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Active.html#isConstant" class="link">Source</a></p><div class="doc"><p>Test whether an <code><a href="Data-Active.html#t:Active">Active</a></code> value is constant.</p></div></div><div class="top"><p class="src"><a name="v:isDynamic" class="def">isDynamic</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Active.html#isDynamic" class="link">Source</a></p><div class="doc"><p>Test whether an <code><a href="Data-Active.html#t:Active">Active</a></code> value is <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:onActive" class="def">onActive</a> :: (a -&gt; b) -&gt; (<a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; b) -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; b <a href="src/Data-Active.html#onActive" class="link">Source</a></p><div class="doc"><p>Fold for <code><a href="Data-Active.html#t:Active">Active</a></code>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 <code><a href="Data-Active.html#t:Dynamic">Dynamic</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:modActive" class="def">modActive</a> :: (a -&gt; b) -&gt; (<a href="Data-Active.html#t:Dynamic">Dynamic</a> a -&gt; <a href="Data-Active.html#t:Dynamic">Dynamic</a> b) -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> b <a href="src/Data-Active.html#modActive" class="link">Source</a></p><div class="doc"><p>Modify an <code><a href="Data-Active.html#t:Active">Active</a></code> value using a case analysis to see whether it
   is constant or dynamic.</p></div></div><div class="top"><p class="src"><a name="v:runActive" class="def">runActive</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; a <a href="src/Data-Active.html#runActive" class="link">Source</a></p><div class="doc"><p>Interpret an <code><a href="Data-Active.html#t:Active">Active</a></code> value as a function from time.</p></div></div><div class="top"><p class="src"><a name="v:activeEra" class="def">activeEra</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Active.html#t:Era">Era</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a>) <a href="src/Data-Active.html#activeEra" class="link">Source</a></p><div class="doc"><p>Get the <code><a href="Data-Active.html#t:Era">Era</a></code> of an <code><a href="Data-Active.html#t:Active">Active</a></code> value (or <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if it is
   a constant/pure value).</p></div></div><div class="top"><p class="src"><a name="v:setEra" class="def">setEra</a> :: <a href="Data-Active.html#t:Era">Era</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#setEra" class="link">Source</a></p><div class="doc"><p>Set the era of an <code><a href="Data-Active.html#t:Active">Active</a></code> value.  Note that this will change a
   constant <code><a href="Data-Active.html#t:Active">Active</a></code> into a dynamic one which happens to have the
   same value at all times.</p></div></div><div class="top"><p class="src"><a name="v:atTime" class="def">atTime</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#atTime" class="link">Source</a></p><div class="doc"><p><code>atTime t a</code> is an active value with the same behavior as <code>a</code>,
   shifted so that it starts at time <code>t</code>.  If <code>a</code> is constant it is
   returned unchanged.</p></div></div><div class="top"><p class="src"><a name="v:activeStart" class="def">activeStart</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; a <a href="src/Data-Active.html#activeStart" class="link">Source</a></p><div class="doc"><p>Get the value of an <code>Active a</code> at the beginning of its era.</p></div></div><div class="top"><p class="src"><a name="v:activeEnd" class="def">activeEnd</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; a <a href="src/Data-Active.html#activeEnd" class="link">Source</a></p><div class="doc"><p>Get the value of an <code>Active a</code> at the end of its era.</p></div></div><h1 id="g:6">Combinators</h1><h2 id="g:7">Special active values</h2><div class="top"><p class="src"><a name="v:ui" class="def">ui</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#ui" class="link">Source</a></p><div class="doc"><p><code>ui</code> represents the <em>unit interval</em>, which takes on the value <code>t</code>
   at time <code>t</code>, and has as its era <code>[0,1]</code>. It is equivalent to
   <code><code><a href="Data-Active.html#v:interval">interval</a></code> 0 1</code>, and can be visualized as follows:</p><p><img src="diagrams/src_Data_Active_uiDia.svg#diagram=uiDia&amp;width=200" /></p><p>On the x-axis is time, and the value that <code>ui</code> takes on is on the
   y-axis.  The shaded portion represents the era.  Note that the
   value of <code>ui</code> (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 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#v:fmap">fmap</a></code> affects all values, both inside and outside the era.
   To manipulate values outside the era specifically, see <code><a href="Data-Active.html#v:clamp">clamp</a></code>
   and <code><a href="Data-Active.html#v:trim">trim</a></code>.</p><p>To alter the <em>values</em> that <code>ui</code> takes on without altering its
   era, use its <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a></code> instances.  For example,
   <code>(*2) &lt;$&gt; ui</code> varies from <code>0</code> to <code>2</code> over the era <code>[0,1]</code>.  To
   alter the era, you can use <code><a href="Data-Active.html#v:stretch">stretch</a></code> or <code><a href="Data-Active.html#v:shift">shift</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:interval" class="def">interval</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Fractional">Fractional</a> a =&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#interval" class="link">Source</a></p><div class="doc"><p><code>interval a b</code> is an active value starting at time <code>a</code>, ending at
   time <code>b</code>, and taking the value <code>t</code> at time <code>t</code>.</p></div></div><h2 id="g:8">Transforming active values</h2><div class="top"><p class="src"><a name="v:stretch" class="def">stretch</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#stretch" class="link">Source</a></p><div class="doc"><p><code>stretch s act</code> &quot;stretches&quot; the active <code>act</code> so that it takes
   <code>s</code> times as long (retaining the same start time).</p></div></div><div class="top"><p class="src"><a name="v:stretchTo" class="def">stretchTo</a> :: <a href="Data-Active.html#t:Duration">Duration</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#stretchTo" class="link">Source</a></p><div class="doc"><p><code>stretchTo d</code> <code><a href="Data-Active.html#v:stretch">stretch</a></code>es an <code><a href="Data-Active.html#t:Active">Active</a></code> so it has duration <code>d</code>.
   Has no effect if (1) <code>d</code> is non-positive, or (2) the <code><a href="Data-Active.html#t:Active">Active</a></code>
   value is constant, or (3) the <code><a href="Data-Active.html#t:Active">Active</a></code> value has zero duration.
 [AJG: conditions (1) and (3) no longer true: to consider changing]</p></div></div><div class="top"><p class="src"><a name="v:during" class="def">during</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#during" class="link">Source</a></p><div class="doc"><p><code>a1 `during` a2</code> <code><a href="Data-Active.html#v:stretch">stretch</a></code>es and <code><a href="Data-Active.html#v:shift">shift</a></code>s <code>a1</code> so that it has the
   same era as <code>a2</code>.  Has no effect if either of <code>a1</code> or <code>a2</code> are constant.</p></div></div><div class="top"><p class="src"><a name="v:shift" class="def">shift</a> :: <a href="Data-Active.html#t:Duration">Duration</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#shift" class="link">Source</a></p><div class="doc"><p><code>shift d act</code> shifts the start time of <code>act</code> by duration <code>d</code>.
   Has no effect on constant values.</p></div></div><div class="top"><p class="src"><a name="v:backwards" class="def">backwards</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#backwards" class="link">Source</a></p><div class="doc"><p>Reverse an active value so the start of its era gets mapped to
   the end and vice versa.  For example, <code>backwards <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be
   visualized as</p><p><img src="diagrams/src_Data_Active_backwardsDia.svg#diagram=backwardsDia&amp;width=200" /></p></div></div><div class="top"><p class="src"><a name="v:snapshot" class="def">snapshot</a> :: <a href="Data-Active.html#t:Time">Time</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#snapshot" class="link">Source</a></p><div class="doc"><p>Take a &quot;snapshot&quot; of an active value at a particular time,
   resulting in a constant value.</p></div></div><h2 id="g:9">Working with values outside the era</h2><div class="top"><p class="src"><a name="v:clamp" class="def">clamp</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#clamp" class="link">Source</a></p><div class="doc"><p>&quot;Clamp&quot; an active value so that it is constant before and after
   its era.  Before the era, <code>clamp a</code> takes on the value of <code>a</code> at
   the start of the era.  Likewise, after the era, <code>clamp a</code> takes
   on the value of <code>a</code> at the end of the era. <code>clamp</code> has no effect
   on constant values.</p><p>For example, <code>clamp <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be visualized as</p><p><img src="diagrams/src_Data_Active_clampDia.svg#diagram=clampDia&amp;width=200" /></p><p>See also <code><a href="Data-Active.html#v:clampBefore">clampBefore</a></code> and <code><a href="Data-Active.html#v:clampAfter">clampAfter</a></code>, which clamp only before
   or after the era, respectively.</p></div></div><div class="top"><p class="src"><a name="v:clampBefore" class="def">clampBefore</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#clampBefore" class="link">Source</a></p><div class="doc"><p>&quot;Clamp&quot; an active value so that it is constant before the start
   of its era. For example, <code>clampBefore <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be visualized as</p><p><img src="diagrams/src_Data_Active_clampBeforeDia.svg#diagram=clampBeforeDia&amp;width=200" /></p><p>See the documentation of <code><a href="Data-Active.html#v:clamp">clamp</a></code> for more information.</p></div></div><div class="top"><p class="src"><a name="v:clampAfter" class="def">clampAfter</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#clampAfter" class="link">Source</a></p><div class="doc"><p>&quot;Clamp&quot; an active value so that it is constant after the end
   of its era.  For example, <code>clampBefore <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be visualized as</p><p><img src="diagrams/src_Data_Active_clampAfterDia.svg#diagram=clampAfterDia&amp;width=200" /></p><p>See the documentation of <code><a href="Data-Active.html#v:clamp">clamp</a></code> for more information.</p></div></div><div class="top"><p class="src"><a name="v:trim" class="def">trim</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#trim" class="link">Source</a></p><div class="doc"><p>&quot;Trim&quot; an active value so that it is empty outside its era.
   <code>trim</code> has no effect on constant values.</p><p>For example, <code>trim <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be visualized as</p><p><img src="diagrams/src_Data_Active_trimDia.svg#diagram=trimDia&amp;width=200" /></p><p>Actually, <code>trim ui</code> is not well-typed, since it is not guaranteed
   that <code>ui</code>'s values will be monoidal (and usually they won't be)!
   But the above image still provides a good intuitive idea of what
   <code>trim</code> is doing. To make this precise we could consider something
   like <code>trim (First . Just <a href="$">$</a> ui)</code>.</p><p>See also <code><a href="Data-Active.html#v:trimBefore">trimBefore</a></code> and <code>trimActive</code>, which trim only before or
   after the era, respectively.</p></div></div><div class="top"><p class="src"><a name="v:trimBefore" class="def">trimBefore</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#trimBefore" class="link">Source</a></p><div class="doc"><p>&quot;Trim&quot; an active value so that it is empty <em>before</em> the start
   of its era. For example, <code>trimBefore <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be visualized as</p><p><img src="diagrams/src_Data_Active_trimBeforeDia.svg#diagram=trimBeforeDia&amp;width=200" /></p><p>See the documentation of <code><a href="Data-Active.html#v:trim">trim</a></code> for more details.</p></div></div><div class="top"><p class="src"><a name="v:trimAfter" class="def">trimAfter</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#trimAfter" class="link">Source</a></p><div class="doc"><p>&quot;Trim&quot; an active value so that it is empty <em>after</em> the end
   of its era.  For example, <code>trimAfter <code><a href="Data-Active.html#v:ui">ui</a></code></code> can be visualized as</p><p><img src="diagrams/src_Data_Active_trimAfterDia.svg#diagram=trimAfterDia&amp;width=200" /></p><p>See the documentation of <code><a href="Data-Active.html#v:trim">trim</a></code> for more details.</p></div></div><h2 id="g:10">Composing active values</h2><div class="top"><p class="src"><a name="v:after" class="def">after</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#after" class="link">Source</a></p><div class="doc"><p><code>a1 `after` a2</code> produces an active that behaves like <code>a1</code> but is
   shifted to start at the end time of <code>a2</code>.  If either <code>a1</code> or <code>a2</code>
   are constant, <code>a1</code> is returned unchanged.</p></div></div><div class="top"><p class="src"><a name="v:-45--62--62-" class="def">(-&gt;&gt;)</a> :: <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> a =&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <span class="fixity">infixr 5</span><span class="rightedge"></span> <a href="src/Data-Active.html#-%3E%3E" class="link">Source</a></p><div class="doc"><p>Sequence/overlay two <code><a href="Data-Active.html#t:Active">Active</a></code> values: shift the second to start
   immediately after the first (using <code><a href="Data-Active.html#v:after">after</a></code>), then compose them
   (using <code><a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#v:-60--62-">&lt;&gt;</a></code>).</p></div></div><div class="top"><p class="src"><a name="v:-124--62--62-" class="def">(|&gt;&gt;)</a> :: <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#%7C%3E%3E" class="link">Source</a></p><div class="doc"><p>&quot;Splice&quot; two <code><a href="Data-Active.html#t:Active">Active</a></code> values together: shift the second to
   start immediately after the first (using <code><a href="Data-Active.html#v:after">after</a></code>), 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.</p></div></div><div class="top"><p class="src"><a name="v:movie" class="def">movie</a> :: [<a href="Data-Active.html#t:Active">Active</a> a] -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#movie" class="link">Source</a></p><div class="doc"><p>Splice together a list of active values using <code><a href="Data-Active.html#v:-124--62--62-">|&gt;&gt;</a></code>.  The list
   must be nonempty.</p></div></div><h1 id="g:11">Discretization</h1><div class="top"><p class="src"><a name="v:discrete" class="def">discrete</a> :: [a] -&gt; <a href="Data-Active.html#t:Active">Active</a> a <a href="src/Data-Active.html#discrete" class="link">Source</a></p><div class="doc"><p>Create an <code>Active</code> which takes on each value in the given list in
   turn during the time <code>[0,1]</code>, with each value getting an equal
   amount of time.  In other words, <code>discrete</code> creates a &quot;slide
   show&quot; 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.</p><p>It is an error to call <code>discrete</code> on the empty list.</p></div></div><div class="top"><p class="src"><a name="v:simulate" class="def">simulate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Rational">Rational</a> -&gt; <a href="Data-Active.html#t:Active">Active</a> a -&gt; [a] <a href="src/Data-Active.html#simulate" class="link">Source</a></p><div class="doc"><p><code>simulate r act</code> simulates the <code><a href="Data-Active.html#t:Active">Active</a></code> value <code>act</code>, returning a
   list of &quot;snapshots&quot; taken at regular intervals from the start
   time to the end time.  The interval used is determined by the
   rate <code>r</code>, which denotes the &quot;frame rate&quot;, that is, the number
   of snapshots per unit time.</p><p>If the <code><a href="Data-Active.html#t:Active">Active</a></code> value is constant (and thus has no start or end
   times), a list of length 1 is returned, containing the constant
   value.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>