-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast generic automaton arrow transformer for AFRP -- -- This library implements a fast and powerful generic automaton arrow -- transformer for arrowized functional reactive programming or automaton -- programming in general. @package netwire @version 3.1.0 -- | This module implements a map, where each key has a timestamp. It -- maintains a timestamp index allowing you delete oldest entries -- quickly. module Control.Wire.TimedMap -- | A timed map is a regular map with timestamps and a timestamp index. data TimedMap t k a TimedMap :: Map k (a, t) -> Map t (Set k) -> TimedMap t k a -- | Underlying map with timestamps. tmMap :: TimedMap t k a -> Map k (a, t) -- | Timestamp index. tmTimes :: TimedMap t k a -> Map t (Set k) -- | The empty timed map. tmEmpty :: TimedMap t k a -- | Find a value with default. tmFindWithDefault :: Ord k => a -> k -> TimedMap t k a -> a -- | Look up the value for the given key. tmLookup :: Ord k => k -> TimedMap t k a -> Maybe a -- | Insert a value into the map. tmInsert :: (Ord k, Ord t) => t -> k -> a -> TimedMap t k a -> TimedMap t k a -- | Delete all items older than the specified timestamp. tmLimitAge :: (Ord t, Ord k) => t -> TimedMap t k a -> TimedMap t k a -- | Delete at least as many oldest items as necessary to limit the map's -- size to the given value. If you have multiple keys with the same -- timestamp, this function can delete more keys than necessary. tmLimitSize :: Ord k => Int -> TimedMap t k a -> TimedMap t k a instance (Show t, Show k, Show a) => Show (TimedMap t k a) -- | This module defines Functor, Applicative, -- Alternative, Monad and MonadPlus instances for -- First and Last monoids. module Control.Wire.Instances instance MonadPlus Last instance Monad Last instance Alternative Last instance Applicative Last instance Functor Last instance MonadPlus First instance Monad First instance Alternative First instance Applicative First instance Functor First -- | Utilities for creating wires. module Control.Wire.Tools -- | Distribute an input value over a list of arrow computations and -- collect the results. distA :: Arrow >~ => [a >~ b] -> (a >~ [b]) -- | Lift an arrow computation to lists of values. mapA :: ArrowChoice >~ => (a >~ b) -> ([a] >~ [b]) -- | Duplicate a value into a tuple. dup :: a -> (a, a) -- | Type classes used in Netwire. module Control.Wire.Classes -- | Monads with a clock. class Monad m => MonadClock t m | m -> t getTime :: MonadClock t m => m t -- | Monads supporting random number generation. class Monad m => MonadRandom m getRandom :: (MonadRandom m, Random a) => m a getRandomR :: (MonadRandom m, Random a) => (a, a) -> m a -- | Arrows which support running monadic computations. class Arrow >~ => ArrowKleisli m >~ | >~ -> m arrM :: (ArrowKleisli m >~, Monad m) => m b >~ b -- | Kleisli arrows, which have IO at their base. arrIO :: (ArrowKleisli m >~, MonadIO m) => IO b >~ b instance MonadRandom IO instance MonadClock Double IO instance (ArrowKleisli m (>~), Monoid l) => ArrowKleisli m (WriterArrow l (>~)) instance (Applicative f, ArrowKleisli m (>~)) => ArrowKleisli m (StaticArrow f (>~)) instance ArrowKleisli m (>~) => ArrowKleisli m (StateArrow s (>~)) instance ArrowKleisli m (>~) => ArrowKleisli m (ReaderArrow e (>~)) instance (ArrowChoice (>~), ArrowKleisli m (>~)) => ArrowKleisli m (ErrorArrow ex (>~)) instance ArrowKleisli m (>~) => ArrowKleisli m (Automaton (>~)) instance Monad m => ArrowKleisli m (Kleisli m) -- | Types used in the netwire library. module Control.Wire.Types -- | Signal networks. -- | Monad-based wires. type WireM e m = Wire e (Kleisli m) -- | Create a wire from the given transformation computation. class Arrow >~ => WireGen >~ mkGen :: WireGen >~ => (a >~ (Either e b, Wire e >~ a b)) -> Wire e >~ a b mkFix :: (WireGen >~, Arrow >~) => (a >~ Either e b) -> Wire e >~ a b -- | Create a pure wire from the given transformation function. class Arrow >~ => WirePure >~ mkPure :: WirePure >~ => (a -> (Either e b, Wire e >~ a b)) -> Wire e >~ a b mkPureFix :: WirePure >~ => (a -> Either e b) -> Wire e >~ a b -- | Convert the given wire to a generic arrow computation. class WireToGen >~ toGen :: WireToGen >~ => Wire e >~ a b -> (a >~ (Either e b, Wire e >~ a b)) -- | Create a stateless wire from the given monadic computation. mkFixM :: Monad m => (a -> m (Either e b)) -> Wire e (Kleisli m) a b -- | Convert the given wire to a generic monadic computation. toGenM :: Monad m => Wire e (Kleisli m) a b -> a -> m (Either e b, Wire e (Kleisli m) a b) -- | Convenience type for wire exceptions. type LastException = Last SomeException -- | Turn an arbitrary exception to a wire exception. inhibitException :: Exception e => e -> LastException -- | Turn a string into a userError exception wrapped by -- LastException. inhibitMsg :: String -> LastException -- | Map a function over the input. mapInputM :: Monad m => (a' -> a) -> Wire e (Kleisli m) a b -> Wire e (Kleisli m) a' b instance Monad m => WireToGen (Kleisli m) instance Monad m => WirePure (Kleisli m) instance Monad m => WireGen (Kleisli m) instance Monad m => Functor (Wire e (Kleisli m) a) instance Monad m => Category (Wire e (Kleisli m)) instance (Monad m, Monoid e) => ArrowZero (Wire e (Kleisli m)) instance MonadWriter w m => ArrowWriter w (Wire e (Kleisli m)) instance Monad m => ArrowTransformer (Wire e) (Kleisli m) instance MonadState s m => ArrowState s (Wire e (Kleisli m)) instance MonadReader r m => ArrowReader r (Wire e (Kleisli m)) instance (Monad m, Monoid e) => ArrowPlus (Wire e (Kleisli m)) instance (MonadFix m, Monoid e) => ArrowLoop (Wire e (Kleisli m)) instance Monad m => ArrowKleisli m (Wire e (Kleisli m)) instance Monad m => ArrowError e (Wire e (Kleisli m)) instance (MonadFix m, Monoid e) => ArrowCircuit (Wire e (Kleisli m)) instance Monad m => ArrowChoice (Wire e (Kleisli m)) instance Monad m => Arrow (Wire e (Kleisli m)) instance Monad m => Applicative (Wire e (Kleisli m) a) instance (Monad m, Monoid e) => Alternative (Wire e (Kleisli m) a) -- | Wire sessions, i.e. running and/or testing wires. module Control.Wire.Session -- | Performs an instant of the given wire. stepWire :: WireToGen >~ => Wire e >~ a b -> (a >~ (Either e b, Wire e >~ a b)) -- | Performs an instant of the given monad-based wire. stepWireM :: Monad m => Wire e (Kleisli m) a b -> a -> m (Either e b, Wire e (Kleisli m) a b) -- | Test a wire. This function runs the given wire continuously printing -- its output on a single line. -- -- The first argument specifies how often the wire's result is printed. -- If you specify 100 here, then the output is printed at every 100th -- frame. testWire :: (ArrowApply >~, ArrowKleisli m >~, MonadIO m, Show e, WireToGen >~) => Int -> (() >~ a) -> (Wire e >~ a String >~ ()) -- | Test a monad-based wire. This function runs the given wire -- continuously printing its output on a single line. -- -- The first argument specifies how often the wire's result is printed. -- If you specify 100 here, then the output is printed at every 100th -- frame. testWireM :: (Show e, MonadIO m) => Int -> m a -> Wire e (Kleisli m) a String -> m () -- | Print a wire result on one line at regular intervals (first argument). -- The second argument is the interval counter. printInt :: (Num a, Ord a) => a -> a -> String -> IO a -- | Print a wire result on one line. printRes :: String -> IO () -- | Turn a wire result into a string for printing. showRes :: Show e => Either e String -> String -- | Increments. Results in 0, if the result is greater than or equal to -- the first argument. succMod :: (Num a, Ord a) => a -> a -> a -- | Monadic computations for wires over Kleisli arrows. The difference -- between these wires and Control.Wire.Classes.arrM is that -- these are exception-aware. module Control.Wire.Prefab.Execute -- | Run monadic actions. class Arrow >~ => WExecute m >~ | >~ -> m execute :: (WExecute m >~, Applicative f) => Wire (f SomeException) >~ (m b) b executeWith :: WExecute m >~ => (SomeException -> e) -> Wire e >~ (m b) b instance MonadBaseControl IO m => WExecute m (Kleisli m) -- | Various wires for queuing. module Control.Wire.Prefab.Queue -- | Queues incoming signals and acts as a dam outputting incoming signals -- in a FIFO fashion (one-way pipe). Note: Incorrect usage can lead to -- congestion. -- -- fifo :: (Monoid e, WirePure >~) => Wire e >~ [a] a -- | Queues incoming signals and acts as a dam outputting incoming signals -- in a LIFO fashion (stack). Note: Incorrect usage can lead to -- congestion. -- -- lifo :: (Monoid e, WirePure >~) => Wire e >~ [a] a -- | Basic wires. module Control.Wire.Prefab.Simple -- | The constant wire. Outputs the given value all the time. constant :: WirePure >~ => b -> Wire e >~ a b -- | The identity wire. Outputs its input signal unchanged. -- -- identity :: WirePure >~ => Wire e >~ a a -- | Force the input signal to weak head normal form, before outputting it. -- Applies seq to the input signal. -- -- force :: WirePure >~ => Wire e >~ b b -- | Force the input signal to normal form, before outputting it. Applies -- deepseq to the input signal. -- -- forceNF :: (NFData b, WirePure >~) => Wire e >~ b b -- | Inject the given Either value as a signal. Left means -- inhibition. -- -- inject :: WirePure >~ => Wire e >~ (Either e b) b -- | Inject the given Maybe value as a signal. Nothing means -- inhibition. -- -- injectEvent :: (Monoid e, WirePure >~) => Wire e >~ (Maybe b) b -- | Wires for signal accumulation. module Control.Wire.Prefab.Accum -- | General accumulator. Outputs the argument value at the first instant, -- then applies the input function repeatedly for subsequent instants. -- This acts like the iterate function for lists. -- -- accum :: WirePure >~ => a -> Wire e >~ (a -> a) a -- | Count upwards from the given starting value. countFrom :: (Enum b, WirePure >~) => b -> Wire e >~ a b -- | Count from the given starting value, repeatedly adding the input -- signal to it. -- -- countStep :: (Num b, WirePure >~) => b -> Wire e >~ b b -- | Apply the given function at the first instant. Then act as the -- identity wire forever. -- -- atFirst :: WirePure >~ => (b -> b) -> Wire e >~ b b -- | Nondeterministic wires. module Control.Wire.Prefab.Split -- | Split the wires in the sense of the underlying arrow. A thread -- in this sense is called a branch. This makes most sense with some -- logic monad (like a list monad transformer) wrapped in a -- Kleisli arrow. -- -- Warning: Incorrect usage will cause space leaks. Use with care! class Arrow >~ => WSplit >~ branch :: (WSplit >~, Foldable f) => Wire e >~ (f b) b quit :: WSplit >~ => Wire e >~ a b quitWith :: WSplit >~ => Wire e >~ b b instance MonadPlus m => WSplit (Kleisli m) -- | Wire transformers for handling inhibited signals. module Control.Wire.Trans.Exhibit -- | Wire transformers for handling inhibited signals. class Arrow >~ => WExhibit >~ event :: WExhibit >~ => Wire e >~ a b -> Wire e >~ a (Maybe b) exhibit :: WExhibit >~ => Wire e >~ a b -> Wire e >~ a (Either e b) gotEvent :: WExhibit >~ => Wire e >~ a b -> Wire e >~ a Bool instance Monad m => WExhibit (Kleisli m) -- | Wire concurrency. -- -- Warning: This module is highly experimental and currently -- causes space leaks. Please use wire concurrency only for short-lived -- threads. module Control.Wire.Trans.Fork -- | Forking wire transformer. Creates a concurrent wire thread and opens a -- communication channel to it. class Arrow >~ => WFork >~ feedWire :: WFork >~ => Wire e >~ (WireChan a b, a) () forkWire :: WFork >~ => Wire e >~ (Wire e >~ a b, WireMgr) (WireChan a b, WireThread) queryWire :: (WFork >~, Monoid e) => Wire e >~ (WireChan a b) b -- | A wire thread manager keeps track of created wire threads. data WireMgr -- | Start a wire manager. startWireMgr :: IO WireMgr -- | Stop a wire manager terminating all threads it keeps track of. stopWireMgr :: WireMgr -> IO () -- | Convenient wrapper around startWireMgr and stopWireMgr. withWireMgr :: (MonadBaseControl IO m, MonadIO m) => (WireMgr -> m a) -> m a -- | A wire channel allows you to send input to and receive output from a -- concurrently running wire. data WireChan a b -- | Feed the given wire thread with input. feedWireChan :: WireChan a b -> a -> IO () -- | Read the given wire's next output. readWireChan :: WireChan a b -> IO b -- | A wire thread is a concurrently running wire. data WireThread -- | Kill the given wire thread. killWireThread :: WireMgr -> WireThread -> IO () instance (MonadBaseControl IO m, MonadIO m) => WFork (Kleisli m) -- | Simple wire transformers. module Control.Wire.Trans.Simple -- | Override input. class Arrow >~ => WOverrideInput >~ (--<) :: (WOverrideInput >~, Arrow >~) => Wire e >~ a b -> (a -> a) -> Wire e >~ a b -- | Apply the given function to the input, until the argument wire starts -- producing. -- -- (>--) :: WOverrideInput >~ => (a -> a) -> Wire e >~ a b -> Wire e >~ a b instance Monad m => WOverrideInput (Kleisli m) -- | Wires for generating and manipulating events. module Control.Wire.Prefab.Event -- | Produces once after the input time interval has passed. -- -- class Arrow >~ => WAfter t >~ | >~ -> t after :: (WAfter t >~, Monoid e) => Wire e >~ t () -- | Produces once as soon as the current global time is later than or -- equal to the input global time and never again. -- -- class Arrow >~ => WAt t >~ | >~ -> t at :: (WAt t >~, Monoid e) => Wire e >~ t () -- | Delay incoming events. class Arrow >~ => WDelayEvents t >~ | >~ -> t delayEvents :: (WDelayEvents t >~, Monoid e) => Wire e >~ ([b], t) b delayEventsSafe :: (WDelayEvents t >~, Monoid e) => Wire e >~ (([b], t), Int) b -- | Periodically produces an event. The period is given by the input time -- delta and can change over time. The current time delta with respect to -- the last production is significant. Does not produce at the first -- instant, unless the first delta is nonpositive. -- -- class Arrow >~ => WPeriodically t >~ | >~ -> t periodically :: (WPeriodically t >~, Monoid e) => Wire e >~ t () -- | Never produces. Always inhibits with the current input signal. -- -- inhibit :: WirePure >~ => Wire e >~ e b -- | Never produces. Equivalent to zeroArrow. -- -- never :: (Monoid e, WirePure >~) => Wire e >~ a b -- | Inhibits as long as the input signal is False. Once it switches -- to True, it produces forever. -- -- asSoonAs :: (Monoid e, WirePure >~) => Wire e >~ Bool () -- | Produces once whenever the input signal switches from False to -- True. -- -- edge :: (Monoid e, WirePure >~) => Wire e >~ Bool () -- | Produces, whenever the current input signal is True. -- -- require :: (Monoid e, WirePure >~) => Wire e >~ Bool () -- | Produces, whenever the current input signal is False. -- -- forbid :: (Monoid e, WirePure >~) => Wire e >~ Bool () -- | Produce as long as the input signal is True. Once it switches -- to False, never produce again. Corresponds to takeWhile -- for lists. -- -- while :: (Monoid e, WirePure >~) => Wire e >~ Bool () -- | Inhibit at the first instant. Then produce forever. -- -- notYet :: (Monoid e, WirePure >~) => Wire e >~ b b -- | Acts like the identity function once and never again. -- -- once :: (Monoid e, WirePure >~) => Wire e >~ b b instance (AdditiveGroup t, MonadClock t m, Ord t) => WPeriodically t (Kleisli m) instance (AdditiveGroup t, MonadClock t m, Ord t) => WDelayEvents t (Kleisli m) instance (MonadClock t m, Ord t) => WAt t (Kleisli m) instance (AdditiveGroup t, MonadClock t m, Ord t) => WAfter t (Kleisli m) -- | Wires for generating random noise. module Control.Wire.Prefab.Random -- | Generate random noise. noise :: (WRandom >~, Random b) => Wire e >~ a b -- | Generate random noise in a certain range given by the input signal. -- -- noiseR :: (WRandom >~, Random b) => Wire e >~ (b, b) b -- | Generate random noise in range 0 <= x < 1. noiseF :: WRandom >~ => Wire e >~ a Double -- | Generate random noise in range -1 <= x < 1. noiseF1 :: (Arrow (Wire e >~), WRandom >~) => Wire e >~ a Double -- | Generate a random boolean, where the input signal is the probability -- to be True. -- -- wackelkontakt :: WRandom >~ => Wire e >~ Double Bool instance MonadRandom m => WRandom (Kleisli m) -- | Signal sampling wires. module Control.Wire.Prefab.Sample -- | Sample the right signal at discrete intervals given by the left input -- signal. -- -- class Arrow >~ => WDiscrete t >~ | >~ -> t discrete :: WDiscrete t >~ => Wire e >~ (t, b) b -- | Keep the signal in the first instant forever. -- -- keep :: WirePure >~ => Wire e >~ b b instance (AdditiveGroup t, MonadClock t m, Ord t) => WDiscrete t (Kleisli m) -- | Supplying clocks to wires. module Control.Wire.Trans.Clock -- | Passes time deltas to the given wire with respect to the clock -- represented by the underlying arrow. Using this wire transformer you -- can program in the more traditional AFRP way using time deltas instead -- of time offsets. Note: The first time delta is 0. -- -- class Arrow >~ => WWithDT t >~ | >~ -> t passDT :: WWithDT t >~ => Wire e >~ t b -> Wire e >~ a b withDT :: WWithDT t >~ => Wire e >~ (a, t) b -> Wire e >~ a b -- | Passes the system time to the given wire. -- -- class Arrow >~ => WWithSysTime t >~ | >~ -> t passSysTime :: WWithSysTime t >~ => Wire e >~ t b -> Wire e >~ a b withSysTime :: WWithSysTime t >~ => Wire e >~ (a, t) b -> Wire e >~ a b -- | Passes the time passed since the first instant to the given wire. -- -- class Arrow >~ => WWithTime t >~ | >~ -> t passTime :: WWithTime t >~ => Wire e >~ t b -> Wire e >~ a b withTime :: WWithTime t >~ => Wire e >~ (a, t) b -> Wire e >~ a b instance MonadClock t m => WWithSysTime t (Kleisli m) instance (AdditiveGroup t, MonadClock t m) => WWithTime t (Kleisli m) instance (AdditiveGroup t, MonadClock t m) => WWithDT t (Kleisli m) -- | Wires for calculus over time. module Control.Wire.Prefab.Calculus -- | Integrate over time. -- -- integral :: (VectorSpace v, WirePure >~, WWithDT t >~, (Scalar v) ~ t) => v -> Wire e >~ v v -- | Calculates the derivative of the input signal over time. -- -- derivative :: (Fractional t, VectorSpace v, WirePure >~, WWithDT t >~, (Scalar v) ~ t) => Wire e >~ v v -- | Various clocks. module Control.Wire.Prefab.Clock -- | Time deltas starting from the time of the first instant. dtime :: (WirePure >~, WWithDT t >~) => Wire e >~ a t -- | Global time. Independent of switching. *System* refers to the wire -- system, not the operating system, so this does not necessarily refer -- to OS time. sysTime :: (WirePure >~, WWithSysTime t >~) => Wire e >~ a t -- | Local time. Starts at the AdditiveGroup notion of zero when -- switching in. time :: (WirePure >~, WWithTime t >~) => Wire e >~ a t -- | Wire transformers for sampling wires. module Control.Wire.Trans.Sample -- | Hold signals. class Arrow >~ => WHold >~ hold :: WHold >~ => Wire e >~ a b -> Wire e >~ a b holdWith :: WHold >~ => b -> Wire e >~ a b -> Wire e >~ a b -- | Samples the given wire at discrete time intervals. Only runs the input -- through the wire, when the next sampling interval starts. -- -- class Arrow >~ => WSample t >~ | >~ -> t sample :: WSample t >~ => Wire e >~ a b -> Wire e >~ (a, t) b -- | Samples the given wire at discrete frame count intervals. Only runs -- the input through the wire, when the next sampling interval starts. -- -- class Arrow >~ => WSampleInt >~ sampleInt :: WSampleInt >~ => Wire e >~ a b -> Wire e >~ (a, Int) b -- | Waits for the argument wire to produce and then keeps the first -- produced value forever. -- -- class Arrow >~ => WSwallow >~ swallow :: WSwallow >~ => Wire e >~ a b -> Wire e >~ a b instance Monad m => WSwallow (Kleisli m) instance Monad m => WSampleInt (Kleisli m) instance (AdditiveGroup t, MonadClock t m, Ord t) => WSample t (Kleisli m) instance Monad m => WHold (Kleisli m) -- | Various signal analysis tools module Control.Wire.Prefab.Analyze -- | Calculate the average of the signal over the given number of last -- samples. If you need an average over all samples ever produced, -- consider using avgAll instead. -- -- avg :: (Fractional v, Unbox v, WirePure >~) => Int -> Wire e >~ v v -- | Calculate the average of the signal over all samples. -- -- Please note that somewhat surprisingly this wire runs in constant -- space and is generally faster than avg, but most applications -- will benefit from averages over only the last few samples. -- -- avgAll :: (Fractional v, WirePure >~) => Wire e >~ v v -- | Calculate the average number of frames per virtual second for the last -- given number of frames. -- -- Please note that this wire uses the clock from the WWithDT -- instance for the underlying arrow. If this clock doesn't represent -- real time, then the output of this wire won't either. avgFps :: (Arrow (Wire e >~), Fractional t, Unbox t, WirePure >~, WWithDT t >~) => Int -> Wire e >~ a t -- | Same as avgFps, but samples only at regular intervals. This can -- improve performance, if querying the clock is an expensive operation. avgFpsInt :: (Arrow (Wire e >~), Fractional t, Unbox t, WirePure >~, WSampleInt >~, WWithDT t >~) => Int -> Int -> Wire e >~ a t -- | Outputs the high peak of the input signal. -- -- highPeak :: (Ord b, WirePure >~) => Wire e >~ b b -- | Outputs the low peak of the input signal. -- -- lowPeak :: (Ord b, WirePure >~) => Wire e >~ b b -- | Outputs the high peak of the input signal with respect to the given -- comparison function. -- -- peakBy :: WirePure >~ => (b -> b -> Ordering) -> Wire e >~ b b -- | Collects all distinct inputs ever received. -- -- collect :: (Ord b, WirePure >~) => Wire e >~ b (Set b) -- | Outputs the last input value on every change of the input signal. Acts -- like the identity wire at the first instant. -- -- diff :: (Eq b, Monoid e, WirePure >~) => Wire e >~ b b -- | Reports the first global time the given input was seen. -- -- firstSeen :: (Ord a, WirePure >~, WWithSysTime t >~) => Wire e >~ a t -- | Reports the last time the given input was seen. Inhibits when seeing a -- signal for the first time. -- -- lastSeen :: (Monoid e, Ord a, WirePure >~, WWithSysTime t >~) => Wire e >~ a t -- | Convenience module importing all the prefab wires. module Control.Wire.Prefab -- | Wire transformers for combining wires. module Control.Wire.Trans.Combine -- | Make the given wire context-sensitive. The right signal is a context -- and the wire will evolve individually for each context. -- -- class Arrow >~ => WContext >~ context :: (WContext >~, Ord k) => Wire e >~ (a, k) b -> Wire e >~ (a, k) b -- | Same as context, but with a time limit. The third signal -- specifies a maximum age. Contexts not used for longer than the maximum -- age are forgotten. -- -- class Arrow >~ => WContextLimit t >~ | >~ -> t contextLimit :: (WContextLimit t >~, Ord k) => Wire e >~ (a, k) b -> Wire e >~ ((a, k), t) b -- | Distribute the input signal over the given wires, evolving each of -- them individually. Discards all inhibited signals. -- -- class Arrow >~ => WDistribute >~ distribute :: WDistribute >~ => [Wire e >~ a b] -> Wire e >~ a [b] instance Monad m => WDistribute (Kleisli m) instance (AdditiveGroup t, MonadClock t m, Ord t) => WContextLimit t (Kleisli m) instance Monad m => WContext (Kleisli m) -- | Memoizing wire transformers. module Control.Wire.Trans.Memoize -- | Remember the most recently produced values. You can limit both the -- maximum age and the number of remembered values. The second input -- value specifies the maximum age, the third specifies the maximum -- number. -- -- Note: Inhibtion is never remembered. -- -- Note: Decreasing the size limit has O(n * log n) complexity, where n -- is the difference to the old limit. -- -- class Arrow >~ => WCache t >~ | >~ -> t cache :: (WCache t >~, Ord a) => Wire e >~ a b -> Wire e >~ ((a, t), Int) b -- | Remember the last produced value. Whenever an input is repeated, the -- argument wire is ignored and the memoized result is returned -- instantly. Note: inhibition will not be remembered. -- -- class Arrow >~ => WPurify >~ purify :: (WPurify >~, Eq a) => Wire e >~ a b -> Wire e >~ a b instance Monad m => WPurify (Kleisli m) instance (AdditiveGroup t, MonadClock t m, Ord t) => WCache t (Kleisli m) -- | Wire transformers. module Control.Wire.Trans -- | Convenience module for the Netwire library. module Control.Wire