-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Functional reactive programming library -- -- This library provides interfaces for and implements wire arrows useful -- both for functional reactive programming (FRP) and locally stateful -- programming (LSP). @package netwire @version 5.0.2 module FRP.Netwire.Utils.Timeline -- | A time line is a non-empty set of samples together with time -- information. data Timeline t a -- | Insert the given data point. insert :: (Ord t) => t -> a -> Timeline t a -> Timeline t a -- | Singleton timeline with the given point. singleton :: t -> a -> Timeline t a -- | Union of two time lines. Right-biased. union :: (Ord t) => Timeline t a -> Timeline t a -> Timeline t a -- | Linearly interpolate the points in the time line, integrate the given -- time interval of the graph, divide by the interval length. linAvg :: (Fractional a, Fractional t, Real t) => t -> t -> Timeline t a -> a -- | Cut the timeline at the given point in time t, such that all -- samples up to but not including t are forgotten. The most -- recent sample before t is moved and interpolated accordingly. linCutL :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> Timeline t a -- | Cut the timeline at the given point in time t, such that all -- samples later than t are forgotten. The most recent sample -- after t is moved and interpolated accordingly. linCutR :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> Timeline t a -- | Look up with linear sampling. linLookup :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> a -- | Integrate the given time interval of the staircase, divide by the -- interval length. scAvg :: (Fractional a, Real t) => t -> t -> Timeline t a -> a -- | Cut the timeline at the given point in time t, such that all -- samples up to but not including t are forgotten. The most -- recent sample before t is moved accordingly. scCutL :: (Ord t) => t -> Timeline t a -> Timeline t a -- | Cut the timeline at the given point in time t, such that all -- samples later than t are forgotten. The earliest sample after -- t is moved accordingly. scCutR :: (Ord t) => t -> Timeline t a -> Timeline t a -- | Look up on staircase. scLookup :: (Ord t) => t -> Timeline t a -> a instance (GHC.Show.Show t, GHC.Show.Show a) => GHC.Show.Show (FRP.Netwire.Utils.Timeline.Timeline t a) instance (GHC.Classes.Ord t, GHC.Read.Read t, GHC.Read.Read a) => GHC.Read.Read (FRP.Netwire.Utils.Timeline.Timeline t a) instance (GHC.Classes.Ord t, GHC.Classes.Ord a) => GHC.Classes.Ord (FRP.Netwire.Utils.Timeline.Timeline t a) instance (GHC.Classes.Eq t, GHC.Classes.Eq a) => GHC.Classes.Eq (FRP.Netwire.Utils.Timeline.Timeline t a) instance (Data.Data.Data t, Data.Data.Data a, GHC.Classes.Ord t) => Data.Data.Data (FRP.Netwire.Utils.Timeline.Timeline t a) instance GHC.Base.Functor (FRP.Netwire.Utils.Timeline.Timeline t) module Control.Wire.Session -- | State delta types with time deltas. class (Monoid s, Real t) => HasTime t s | s -> t -- | Extract the current time delta. dtime :: HasTime t s => s -> t -- | State delta generators as required for wire sessions, most notably to -- generate time deltas. These are mini-wires with the sole purpose of -- generating these deltas. newtype Session m s Session :: m (s, Session m s) -> Session m s [stepSession] :: Session m s -> m (s, Session m s) -- | This state delta type denotes time deltas. This is necessary for most -- FRP applications. data Timed t s Timed :: t -> s -> Timed t s -- | State delta generator for a real time clock. clockSession :: (MonadIO m) => Session m (s -> Timed NominalDiffTime s) -- | Non-extending version of clockSession. clockSession_ :: (Applicative m, MonadIO m) => Session m (Timed NominalDiffTime ()) -- | State delta generator for a simple counting clock. Denotes a fixed -- framerate. This is likely more useful than clockSession for -- simulations and real-time games. countSession :: (Applicative m) => t -> Session m (s -> Timed t s) -- | Non-extending version of countSession. countSession_ :: (Applicative m) => t -> Session m (Timed t ()) instance Data.Traversable.Traversable (Control.Wire.Session.Timed t) instance (GHC.Show.Show t, GHC.Show.Show s) => GHC.Show.Show (Control.Wire.Session.Timed t s) instance (GHC.Read.Read t, GHC.Read.Read s) => GHC.Read.Read (Control.Wire.Session.Timed t s) instance (GHC.Classes.Ord t, GHC.Classes.Ord s) => GHC.Classes.Ord (Control.Wire.Session.Timed t s) instance GHC.Base.Functor (Control.Wire.Session.Timed t) instance Data.Foldable.Foldable (Control.Wire.Session.Timed t) instance (GHC.Classes.Eq t, GHC.Classes.Eq s) => GHC.Classes.Eq (Control.Wire.Session.Timed t s) instance (Data.Data.Data t, Data.Data.Data s) => Data.Data.Data (Control.Wire.Session.Timed t s) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Wire.Session.Session m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Wire.Session.Session m) instance (GHC.Base.Monoid s, GHC.Real.Real t) => Control.Wire.Session.HasTime t (Control.Wire.Session.Timed t s) instance (GHC.Base.Monoid s, GHC.Num.Num t) => GHC.Base.Monoid (Control.Wire.Session.Timed t s) module Control.Wire.Core -- | A wire is a signal function. It maps a reactive value to another -- reactive value. data Wire s e m a b [WArr] :: (Either e a -> Either e b) -> Wire s e m a b [WConst] :: Either e b -> Wire s e m a b [WGen] :: (s -> Either e a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b [WId] :: Wire s e m a a [WPure] :: (s -> Either e a -> (Either e b, Wire s e m a b)) -> Wire s e m a b -- | Perform one step of the given wire. stepWire :: (Monad m) => Wire s e m a b -> s -> Either e a -> m (Either e b, Wire s e m a b) -- | Construct a stateless wire from the given signal mapping function. mkConst :: Either e b -> Wire s e m a b -- | Construct the empty wire, which inhibits forever. mkEmpty :: (Monoid e) => Wire s e m a b -- | Construct a stateful wire from the given transition function. mkGen :: (Monad m, Monoid s) => (s -> a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b -- | Construct a stateless wire from the given transition function. mkGen_ :: (Monad m) => (a -> m (Either e b)) -> Wire s e m a b -- | Construct a stateful wire from the given transition function. mkGenN :: (Monad m) => (a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b -- | Construct the identity wire. mkId :: Wire s e m a a -- | Construct a pure stateful wire from the given transition function. mkPure :: (Monoid s) => (s -> a -> (Either e b, Wire s e m a b)) -> Wire s e m a b -- | Construct a pure stateless wire from the given transition function. mkPure_ :: (a -> Either e b) -> Wire s e m a b -- | Construct a pure stateful wire from the given transition function. mkPureN :: (a -> (Either e b, Wire s e m a b)) -> Wire s e m a b -- | Construct a pure stateful wire from the given signal function. mkSF :: (Monoid s) => (s -> a -> (b, Wire s e m a b)) -> Wire s e m a b -- | Construct a pure stateless wire from the given function. mkSF_ :: (a -> b) -> Wire s e m a b -- | Construct a pure stateful wire from the given signal function. mkSFN :: (a -> (b, Wire s e m a b)) -> Wire s e m a b -- | This wire delays its input signal by the smallest possible -- (semantically infinitesimal) amount of time. You can use it when you -- want to use feedback (ArrowLoop): If the user of the feedback -- depends on now, delay the value before feeding it back. The -- argument value is the replacement signal at the beginning. -- -- delay :: a -> Wire s e m a a -- | Evaluate the input signal using the given Strategy here. This -- wire evaluates only produced values. -- -- evalWith :: Strategy a -> Wire s e m a a -- | Force the input signal to WHNF here. This wire forces both produced -- values and inhibition values. -- -- force :: Wire s e m a a -- | Force the input signal to NF here. This wire forces only produced -- values. -- -- forceNF :: (NFData a) => Wire s e m a a -- | Left-strict version of &&& for functions. (&&&!) :: (a -> b) -> (a -> c) -> (a -> (b, c)) -- | Left-strict version of *** for functions. (***!) :: (a -> c) -> (b -> d) -> ((a, b) -> (c, d)) -- | Left-strict tuple. lstrict :: (a, b) -> (a, b) -- | Apply the given monad morphism to the wire's underlying monad. mapWire :: (Monad m', Monad m) => (forall a. m' a -> m a) -> Wire s e m' a b -> Wire s e m a b instance (GHC.Base.Monad m, GHC.Base.Monoid e) => GHC.Base.Alternative (Control.Wire.Core.Wire s e m a) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Wire.Core.Wire s e m a) instance GHC.Base.Monad m => Control.Arrow.Arrow (Control.Wire.Core.Wire s e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => Control.Arrow.ArrowChoice (Control.Wire.Core.Wire s e m) instance Control.Monad.Fix.MonadFix m => Control.Arrow.ArrowLoop (Control.Wire.Core.Wire s e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => Control.Arrow.ArrowPlus (Control.Wire.Core.Wire s e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => Control.Arrow.ArrowZero (Control.Wire.Core.Wire s e m) instance GHC.Base.Monad m => Control.Category.Category (Control.Wire.Core.Wire s e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => Data.Profunctor.Choice.Choice (Control.Wire.Core.Wire s e m) instance (GHC.Base.Monad m, GHC.Float.Floating b) => GHC.Float.Floating (Control.Wire.Core.Wire s e m a b) instance (GHC.Base.Monad m, GHC.Real.Fractional b) => GHC.Real.Fractional (Control.Wire.Core.Wire s e m a b) instance GHC.Base.Monad m => GHC.Base.Functor (Control.Wire.Core.Wire s e m a) instance (GHC.Base.Monad m, Data.String.IsString b) => Data.String.IsString (Control.Wire.Core.Wire s e m a b) instance (GHC.Base.Monad m, GHC.Base.Monoid b) => GHC.Base.Monoid (Control.Wire.Core.Wire s e m a b) instance (GHC.Base.Monad m, GHC.Num.Num b) => GHC.Num.Num (Control.Wire.Core.Wire s e m a b) instance GHC.Base.Monad m => Data.Profunctor.Unsafe.Profunctor (Control.Wire.Core.Wire s e m) instance (GHC.Base.Monad m, Data.Semigroup.Semigroup b) => Data.Semigroup.Semigroup (Control.Wire.Core.Wire s e m a b) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => Data.Profunctor.Strong.Strong (Control.Wire.Core.Wire s e m) module Control.Wire.Run -- | This function runs the given wire using the given state delta -- generator. It constantly shows the output of the wire on one line on -- stdout. Press Ctrl-C to abort. testWire :: (MonadIO m, Show b, Show e) => Session m s -> (forall a. Wire s e Identity a b) -> m c -- | This function runs the given wire using the given state delta -- generator. It constantly shows the output of the wire on one line on -- stdout. Press Ctrl-C to abort. testWireM :: (Monad m', MonadIO m, Show b, Show e) => (forall a. m' a -> m a) -> Session m s -> (forall a. Wire s e m' a b) -> m c module Control.Wire.Time -- | Local time starting from zero. time :: (HasTime t s) => Wire s e m a t -- | Local time starting from zero, converted to your favorite fractional -- type. timeF :: (Fractional b, HasTime t s, Monad m) => Wire s e m a b -- | Local time starting from the given value. timeFrom :: (HasTime t s) => t -> Wire s e m a t module Control.Wire.Unsafe.Event -- | Denotes a stream of values, each together with time of occurrence. -- Since Event is commonly used for functional reactive -- programming it does not define most of the usual instances to protect -- continuous time and discrete event occurrence semantics. data Event a Event :: a -> Event a NoEvent :: Event a -- | Fold the given event. event :: b -> (a -> b) -> Event a -> b -- | Merge two events using the given function when both occur at the same -- time. merge :: (a -> a -> a) -> Event a -> Event a -> Event a -- | Did the given event occur? occurred :: Event a -> Bool -- | Each time the given event occurs, perform the given action with the -- value the event carries. The resulting event carries the result of the -- action. -- -- onEventM :: (Monad m) => (a -> m b) -> Wire s e m (Event a) (Event b) instance GHC.Base.Functor Control.Wire.Unsafe.Event.Event instance Data.Semigroup.Semigroup a => GHC.Base.Monoid (Control.Wire.Unsafe.Event.Event a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Control.Wire.Unsafe.Event.Event a) instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Control.Wire.Unsafe.Event.Event a) module Control.Wire.Event -- | Denotes a stream of values, each together with time of occurrence. -- Since Event is commonly used for functional reactive -- programming it does not define most of the usual instances to protect -- continuous time and discrete event occurrence semantics. data Event a -- | At the given point in time. -- -- at :: (HasTime t s) => t -> Wire s e m a (Event a) -- | Never occurs. never :: Wire s e m a (Event b) -- | Occurs once immediately. -- -- now :: Wire s e m a (Event a) -- | Periodic occurrence with the given time period. First occurrence is -- now. -- -- periodic :: (HasTime t s) => t -> Wire s e m a (Event a) -- | Periodic occurrence with the given time period. First occurrence is -- now. The event values are picked one by one from the given list. When -- the list is exhausted, the event does not occur again. periodicList :: (HasTime t s) => t -> [b] -> Wire s e m a (Event b) -- | Occurs each time the predicate becomes true for the input signal, for -- example each time a given threshold is reached. -- -- became :: (a -> Bool) -> Wire s e m a (Event a) -- | Occurs each time the predicate becomes false for the input signal, for -- example each time a given threshold is no longer exceeded. -- -- noLonger :: (a -> Bool) -> Wire s e m a (Event a) -- | Events occur first when the predicate is false then when it is true, -- and then this pattern repeats. -- -- edge :: (a -> Bool) -> Wire s e m a (Event a) -- | Merge events with the leftmost event taking precedence. Equivalent to -- using the monoid interface with First. Infixl 5. -- -- (<&) :: (Monad m) => Wire s e m a (Event b) -> Wire s e m a (Event b) -> Wire s e m a (Event b) infixl 5 <& -- | Merge events with the rightmost event taking precedence. Equivalent to -- using the monoid interface with Last. Infixl 5. -- -- (&>) :: (Monad m) => Wire s e m a (Event b) -> Wire s e m a (Event b) -> Wire s e m a (Event b) infixl 5 &> -- | Forget the first given number of occurrences. -- -- dropE :: Int -> Wire s e m (Event a) (Event a) -- | Forget all initial occurrences until the given predicate becomes -- false. -- -- dropWhileE :: (a -> Bool) -> Wire s e m (Event a) (Event a) -- | Forget all occurrences for which the given predicate is false. -- -- filterE :: (a -> Bool) -> Wire s e m (Event a) (Event a) -- | Merge two events using the given function when both occur at the same -- time. merge :: (a -> a -> a) -> Event a -> Event a -> Event a -- | Left-biased event merge. mergeL :: Event a -> Event a -> Event a -- | Right-biased event merge. mergeR :: Event a -> Event a -> Event a -- | Forget the first occurrence. -- -- notYet :: Wire s e m (Event a) (Event a) -- | Forget all occurrences except the first. -- -- once :: Wire s e m (Event a) (Event a) -- | Forget all but the first given number of occurrences. -- -- takeE :: Int -> Wire s e m (Event a) (Event a) -- | Forget all but the initial occurrences for which the given predicate -- is true. -- -- takeWhileE :: (a -> Bool) -> Wire s e m (Event a) (Event a) -- | Left scan for events. Each time an event occurs, apply the given -- function. -- -- accumE :: (b -> a -> b) -> b -> Wire s e m (Event a) (Event b) -- | Left scan for events with no initial value. Each time an event occurs, -- apply the given function. The first event is produced unchanged. -- -- accum1E :: (a -> a -> a) -> Wire s e m (Event a) (Event a) -- | On each occurrence, apply the function the event carries. -- -- iterateE :: a -> Wire s e m (Event (a -> a)) (Event a) -- | Maximum of all events. -- -- maximumE :: (Ord a) => Wire s e m (Event a) (Event a) -- | Minimum of all events. -- -- minimumE :: (Ord a) => Wire s e m (Event a) (Event a) -- | Product of all events. -- -- productE :: (Num a) => Wire s e m (Event a) (Event a) -- | Sum of all events. -- -- sumE :: (Num a) => Wire s e m (Event a) (Event a) module Control.Wire.Interval -- | Inhibit forever with the given value. -- -- inhibit :: e -> Wire s e m a b -- | After the given time period. -- -- after :: (HasTime t s, Monoid e) => t -> Wire s e m a a -- | For the given time period. -- -- for :: (HasTime t s, Monoid e) => t -> Wire s e m a a -- | When the given predicate is false for the input signal. -- -- unless :: (Monoid e) => (a -> Bool) -> Wire s e m a a -- | When the given predicate is true for the input signal. -- -- when :: (Monoid e) => (a -> Bool) -> Wire s e m a a -- | Alias for hold. asSoonAs :: (Monoid e) => Wire s e m (Event a) a -- | Start each time the left event occurs, stop each time the right event -- occurs. -- -- between :: (Monoid e) => Wire s e m (a, Event b, Event c) a -- | Start when the event occurs for the first time reflecting its latest -- value. -- -- hold :: (Monoid e) => Wire s e m (Event a) a -- | Hold each event occurrence for the given time period. Inhibits when no -- event occurred for the given amount of time. New occurrences override -- old occurrences, even when they are still held. -- -- holdFor :: (HasTime t s, Monoid e) => t -> Wire s e m (Event a) a -- | Produce until the given event occurs. When it occurs, inhibit with its -- value forever. -- -- until :: (Monoid e) => Wire s e m (a, Event b) a module Control.Wire.Switch -- | Acts like the first wire until it inhibits, then switches to the -- second wire. Infixr 1. -- -- (-->) :: (Monad m) => Wire s e m a b -> Wire s e m a b -> Wire s e m a b infixr 1 --> -- | Acts like the first wire until the second starts producing, at which -- point it switches to the second wire. Infixr 1. -- -- (>--) :: (Monad m) => Wire s e m a b -> Wire s e m a b -> Wire s e m a b infixr 1 >-- -- | Route the left input signal based on the current mode. The right input -- signal can be used to change the current mode. When switching away -- from a mode and then switching back to it, it will be resumed. Freezes -- time during inactivity. -- -- modes :: (Monad m, Ord k) => k -> (k -> Wire s e m a b) -> Wire s e m (a, Event k) b -- | Intrinsic switch: Start with the given wire. As soon as its event -- occurs, switch to the wire in the event's value. -- -- switch :: (Monad m, Monoid s) => Wire s e m a (b, Event (Wire s e m a b)) -> Wire s e m a b -- | Intrinsic switch: Delayed version of switch. -- -- dSwitch :: (Monad m) => Wire s e m a (b, Event (Wire s e m a b)) -> Wire s e m a b -- | Intrinsic continuable switch: kSwitch w1 w2 starts with -- w1. Its signal is received by w2, which may choose -- to switch to a new wire. Passes the wire we are switching away from to -- the new wire, such that it may be reused in it. -- -- kSwitch :: (Monad m, Monoid s) => Wire s e m a b -> Wire s e m (a, b) (Event (Wire s e m a b -> Wire s e m a b)) -> Wire s e m a b -- | Intrinsic continuable switch: Delayed version of kSwitch. -- -- dkSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, b) (Event (Wire s e m a b -> Wire s e m a b)) -> Wire s e m a b -- | Extrinsic switch: Start with the given wire. Each time the input event -- occurs, switch to the wire it carries. -- -- rSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, Event (Wire s e m a b)) b -- | Extrinsic switch: Delayed version of rSwitch. -- -- drSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, Event (Wire s e m a b)) b -- | Acts like the first wire until an event occurs then switches to the -- second wire. Behaves like this wire until the event occurs at which -- point a *new* instance of the first wire is switched to. -- -- alternate :: (Monad m) => Wire s e m a b -> Wire s e m a b -> Wire s e m (a, Event x) b -- | Extrinsic continuable switch. This switch works like rSwitch, -- except that it passes the wire we are switching away from to the new -- wire. -- -- krSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, Event (Wire s e m a b -> Wire s e m a b)) b -- | Extrinsic continuable switch. Delayed version of krSwitch. -- -- dkrSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, Event (Wire s e m a b -> Wire s e m a b)) b module Control.Wire -- | Pure wires. type WireP s e = Wire s e Identity -- | Simple wires with time. type SimpleWire = Wire (Timed NominalDiffTime ()) () Identity -- | Identity functor and monad. (a non-strict monad) newtype Identity a :: * -> * Identity :: a -> Identity a [runIdentity] :: Identity a -> a -- | This is a length of time, as measured by UTC. Conversion functions -- will treat it as seconds. It has a precision of 10^-12 s. It ignores -- leap-seconds, so it's not necessarily a fixed amount of clock time. -- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 -- day), regardless of whether a leap-second intervened. data NominalDiffTime :: * module FRP.Netwire.Analyze -- | Calculate the average of the signal over the given interval (from -- now). This is done by calculating the integral of the corresponding -- linearly interpolated graph and dividing it by the interval length. -- See linAvg for details. -- -- Linear interpolation can be slow. If you don't need it, you can use -- the staircase variant sAvg. -- -- Example: lAvg 2 -- -- lAvg :: (Fractional a, Fractional t, HasTime t s) => t -> Wire s e m a a -- | Produce a linearly interpolated graph for the given points in time, -- where the magnitudes of the points are distances from now. -- -- Linear interpolation can be slow. If you don't need it, you can use -- the faster staircase variant sGraph. -- -- Example: lGraph [0, 1, 2] will output the interpolated inputs -- at now, one second before now and two seconds before now. -- -- lGraph :: (Fractional a, Fractional t, HasTime t s) => [t] -> Wire s e m a [a] -- | Graph the given interval from now with the given number of evenly -- distributed points in time. Convenience interface to lGraph. -- -- Linear interpolation can be slow. If you don't need it, you can use -- the faster staircase variant sGraphN. -- -- lGraphN :: (Fractional a, Fractional t, HasTime t s) => t -> Int -> Wire s e m a [a] -- | Calculate the average of the signal over the given interval (from -- now). This is done by calculating the integral of the corresponding -- staircase graph and dividing it by the interval length. See -- scAvg for details. -- -- See also lAvg. -- -- Example: sAvg 2 -- -- sAvg :: (Fractional a, Fractional t, HasTime t s) => t -> Wire s e m a a -- | Produce a staircase graph for the given points in time, where the -- magnitudes of the points are distances from now. -- -- See also lGraph. -- -- Example: sGraph [0, 1, 2] will output the inputs at -- now, one second before now and two seconds before now. -- -- sGraph :: (Fractional t, HasTime t s) => [t] -> Wire s e m a [a] -- | Graph the given interval from now with the given number of evenly -- distributed points in time. Convenience interface to sGraph. -- -- See also lGraphN. -- -- sGraphN :: (Fractional t, HasTime t s) => t -> Int -> Wire s e m a [a] -- | High peak. -- -- highPeak :: (Ord a) => Wire s e m a a -- | High peak with respect to the given comparison function. -- -- highPeakBy :: (a -> a -> Ordering) -> Wire s e m a a -- | Low peak. -- -- lowPeak :: (Ord a) => Wire s e m a a -- | Low peak with respect to the given comparison function. -- -- lowPeakBy :: (a -> a -> Ordering) -> Wire s e m a a -- | Average framerate over the last given number of samples. One important -- thing to note is that the value of this wire will generally disagree -- with sAvg composed with framerate. This is expected, -- because this wire simply calculates the arithmetic mean, whereas -- sAvg will actually integrate the framerate graph. -- -- Note: This wire is for debugging purposes only, because it exposes -- discrete time. Do not taint your application with discrete time. -- -- avgFps :: (RealFloat b, HasTime t s) => Int -> Wire s e m a b -- | Current framerate. -- -- Note: This wire is for debugging purposes only, because it exposes -- discrete time. Do not taint your application with discrete time. -- -- framerate :: (Eq b, Fractional b, HasTime t s, Monoid e) => Wire s e m a b module FRP.Netwire.Move -- | Time derivative of the input signal. -- -- derivative :: (RealFloat a, HasTime t s, Monoid e) => Wire s e m a a -- | Integrate the input signal over time. -- -- integral :: (Fractional a, HasTime t s) => a -> Wire s e m a a -- | Integrate the left input signal over time, but apply the given -- correction function to it. This can be used to implement collision -- detection/reaction. -- -- The right signal of type w is the world value. It is -- just passed to the correction function for reference and is not used -- otherwise. -- -- The correction function must be idempotent with respect to the world -- value: f w (f w x) = f w x. This is necessary and sufficient -- to protect time continuity. -- -- integralWith :: (Fractional a, HasTime t s) => (w -> a -> a) -> a -> Wire s e m (a, w) a module FRP.Netwire.Noise -- | Noise events with the given distance between events. Use hold -- or holdFor to generate a staircase. noise :: (HasTime t s, Random b, RandomGen g) => t -> g -> Wire s e m a (Event b) -- | Noise events with the given distance between events. Noise will be in -- the given range. Use hold or holdFor to generate a -- staircase. noiseR :: (HasTime t s, Random b, RandomGen g) => t -> (b, b) -> g -> Wire s e m a (Event b) -- | Randomly produce or inhibit with the given probability, each time for -- the given duration. -- -- The name Wackelkontakt (German for slack joint) is a -- Netwire running gag. It makes sure that you revisit the documentation -- from time to time. =) -- -- wackelkontakt :: (HasTime t s, Monad m, Monoid e, RandomGen g) => t -> Double -> g -> Wire s e m a a -- | Convenience interface to noise for StdGen. stdNoise :: (HasTime t s, Random b) => t -> Int -> Wire s e m a (Event b) -- | Convenience interface to noiseR for StdGen. stdNoiseR :: (HasTime t s, Monad m, Random b) => t -> (b, b) -> Int -> Wire s e m a (Event b) -- | Convenience interface to wackelkontakt for StdGen. stdWackelkontakt :: (HasTime t s, Monad m, Monoid e) => t -> Double -> Int -> Wire s e m a a module FRP.Netwire -- | A wire is a signal function. It maps a reactive value to another -- reactive value. data Wire s e m a b -- | Pure wires. type WireP s e = Wire s e Identity -- | Simple wires with time. type SimpleWire = Wire (Timed NominalDiffTime ()) () Identity -- | This wire delays its input signal by the smallest possible -- (semantically infinitesimal) amount of time. You can use it when you -- want to use feedback (ArrowLoop): If the user of the feedback -- depends on now, delay the value before feeding it back. The -- argument value is the replacement signal at the beginning. -- -- delay :: a -> Wire s e m a a -- | Evaluate the input signal using the given Strategy here. This -- wire evaluates only produced values. -- -- evalWith :: Strategy a -> Wire s e m a a -- | Force the input signal to WHNF here. This wire forces both produced -- values and inhibition values. -- -- force :: Wire s e m a a -- | Force the input signal to NF here. This wire forces only produced -- values. -- -- forceNF :: (NFData a) => Wire s e m a a