-- 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.3

module Control.Wire.Core

-- | A wire is a signal function. It maps a reactive value to another
--   reactive value.
data Wire s e (m :: Type -> Type) a b
[WArr] :: forall e a b s (m :: Type -> Type). (Either e a -> Either e b) -> Wire s e m a b
[WConst] :: forall e b s (m :: Type -> Type) a. Either e b -> Wire s e m a b
[WGen] :: forall s e a (m :: Type -> Type) b. (s -> Either e a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b
[WId] :: forall s e (m :: Type -> Type) a. Wire s e m a a
[WPure] :: forall s e a b (m :: Type -> Type). (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 :: forall e b s (m :: Type -> Type) a. Either e b -> Wire s e m a b

-- | Construct the empty wire, which inhibits forever.
mkEmpty :: forall e s (m :: Type -> Type) a b. 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 :: forall s e (m :: Type -> Type) a. Wire s e m a a

-- | Construct a pure stateful wire from the given transition function.
mkPure :: forall s a e b (m :: Type -> Type). 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_ :: forall a e b s (m :: Type -> Type). (a -> Either e b) -> Wire s e m a b

-- | Construct a pure stateful wire from the given transition function.
mkPureN :: forall a e b s (m :: Type -> Type). (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 :: forall s a b e (m :: Type -> Type). 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_ :: forall a b s e (m :: Type -> Type). (a -> b) -> Wire s e m a b

-- | Construct a pure stateful wire from the given signal function.
mkSFN :: forall a b s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: before now.
--   
delay :: forall a s e (m :: Type -> Type). a -> Wire s e m a a

-- | Evaluate the input signal using the given Strategy here. This
--   wire evaluates only produced values.
--   
--   
--   
- Depends: now.
--   
evalWith :: forall a s e (m :: Type -> Type). Strategy a -> Wire s e m a a

-- | Force the input signal to WHNF here. This wire forces both produced
--   values and inhibition values.
--   
--   
--   
- Depends: now.
--   
force :: forall s e (m :: Type -> Type) a. Wire s e m a a

-- | Force the input signal to NF here. This wire forces only produced
--   values.
--   
--   
--   
- Depends: now.
--   
forceNF :: forall a s e (m :: Type -> Type). 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 a1. () => m' a1 -> m a1) -> Wire s e m' a b -> Wire s e m a b
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid e) => GHC.Internal.Base.Alternative (Control.Wire.Core.Wire s e m a)
instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Applicative (Control.Wire.Core.Wire s e m a)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid e) => GHC.Internal.Control.Arrow.ArrowChoice (Control.Wire.Core.Wire s e m)
instance GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Arrow.ArrowLoop (Control.Wire.Core.Wire s e m)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid e) => GHC.Internal.Control.Arrow.ArrowPlus (Control.Wire.Core.Wire s e m)
instance GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.Arrow (Control.Wire.Core.Wire s e m)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid e) => GHC.Internal.Control.Arrow.ArrowZero (Control.Wire.Core.Wire s e m)
instance GHC.Internal.Base.Monad m => GHC.Internal.Control.Category.Category (Control.Wire.Core.Wire s e m)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid e) => Data.Profunctor.Choice.Choice (Control.Wire.Core.Wire s e m)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Float.Floating b) => GHC.Internal.Float.Floating (Control.Wire.Core.Wire s e m a b)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Real.Fractional b) => GHC.Internal.Real.Fractional (Control.Wire.Core.Wire s e m a b)
instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Functor (Control.Wire.Core.Wire s e m a)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Data.String.IsString b) => GHC.Internal.Data.String.IsString (Control.Wire.Core.Wire s e m a b)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid b) => GHC.Internal.Base.Monoid (Control.Wire.Core.Wire s e m a b)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Num.Num b) => GHC.Internal.Num.Num (Control.Wire.Core.Wire s e m a b)
instance GHC.Internal.Base.Monad m => Data.Profunctor.Unsafe.Profunctor (Control.Wire.Core.Wire s e m)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Semigroup b) => GHC.Internal.Base.Semigroup (Control.Wire.Core.Wire s e m a b)
instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid e) => Data.Profunctor.Strong.Strong (Control.Wire.Core.Wire s e m)

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 :: Type -> Type) s
Session :: m (s, Session m s) -> Session (m :: Type -> Type) s
[stepSession] :: Session (m :: Type -> Type) 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 :: forall (m :: Type -> Type) s. MonadIO m => Session m (s -> Timed NominalDiffTime s)

-- | Non-extending version of clockSession.
clockSession_ :: forall (m :: Type -> Type). (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 :: forall (m :: Type -> Type) t s. Applicative m => t -> Session m (s -> Timed t s)

-- | Non-extending version of countSession.
countSession_ :: forall (m :: Type -> Type) t. Applicative m => t -> Session m (Timed t ())
instance GHC.Internal.Base.Applicative m => GHC.Internal.Base.Applicative (Control.Wire.Session.Session m)
instance (GHC.Internal.Data.Data.Data t, GHC.Internal.Data.Data.Data s) => GHC.Internal.Data.Data.Data (Control.Wire.Session.Timed t s)
instance (GHC.Classes.Eq t, GHC.Classes.Eq s) => GHC.Classes.Eq (Control.Wire.Session.Timed t s)
instance GHC.Internal.Data.Foldable.Foldable (Control.Wire.Session.Timed t)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Control.Wire.Session.Session m)
instance GHC.Internal.Base.Functor (Control.Wire.Session.Timed t)
instance (GHC.Internal.Base.Semigroup s, GHC.Internal.Base.Monoid s, GHC.Internal.Real.Real t) => Control.Wire.Session.HasTime t (Control.Wire.Session.Timed t s)
instance (GHC.Internal.Base.Semigroup s, GHC.Internal.Base.Monoid s, GHC.Internal.Num.Num t) => GHC.Internal.Base.Monoid (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.Internal.Read.Read t, GHC.Internal.Read.Read s) => GHC.Internal.Read.Read (Control.Wire.Session.Timed t s)
instance (GHC.Internal.Base.Semigroup s, GHC.Internal.Num.Num t) => GHC.Internal.Base.Semigroup (Control.Wire.Session.Timed t s)
instance (GHC.Internal.Show.Show t, GHC.Internal.Show.Show s) => GHC.Internal.Show.Show (Control.Wire.Session.Timed t s)
instance GHC.Internal.Data.Traversable.Traversable (Control.Wire.Session.Timed t)

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 :: forall t s e (m :: Type -> Type) a. HasTime t s => Wire s e m a t

-- | Local time starting from zero, converted to your favorite fractional
--   type.
timeF :: forall b t s (m :: Type -> Type) e a. (Fractional b, HasTime t s, Monad m) => Wire s e m a b

-- | Local time starting from the given value.
timeFrom :: forall t s e (m :: Type -> Type) a. 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.
--   
--   
--   
- Depends: now.
--   
onEventM :: Monad m => (a -> m b) -> Wire s e m (Event a) (Event b)
instance GHC.Internal.Base.Functor Control.Wire.Unsafe.Event.Event
instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Monoid (Control.Wire.Unsafe.Event.Event a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Control.Wire.Unsafe.Event.Event a)
instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.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.
--   
--   
--   
- Depends: now when occurring.
--   
at :: forall t s e (m :: Type -> Type) a. HasTime t s => t -> Wire s e m a (Event a)

-- | Never occurs.
never :: forall s e (m :: Type -> Type) a b. Wire s e m a (Event b)

-- | Occurs once immediately.
--   
--   
--   
- Depends: now when occurring.
--   
now :: forall s e (m :: Type -> Type) a. Wire s e m a (Event a)

-- | Periodic occurrence with the given time period. First occurrence is
--   now.
--   
--   
--   
- Depends: now when occurring.
--   
periodic :: forall t s e (m :: Type -> Type) a. 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 :: forall t s b e (m :: Type -> Type) a. 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.
--   
--   
--   
- Depends: now.
--   
became :: forall a s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: now.
--   
noLonger :: forall a s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: now.
--   
edge :: forall a s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: now on both.
--   
- Inhibits: when any of the two wires inhibit.
--   
(<&) :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Depends: now on both.
--   
- Inhibits: when any of the two wires inhibit.
--   
(&>) :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Depends: now.
--   
dropE :: forall s e (m :: Type -> Type) a. Int -> Wire s e m (Event a) (Event a)

-- | Forget all initial occurrences until the given predicate becomes
--   false.
--   
--   
--   
- Depends: now.
--   
dropWhileE :: forall a s e (m :: Type -> Type). (a -> Bool) -> Wire s e m (Event a) (Event a)

-- | Forget all occurrences for which the given predicate is false.
--   
--   
--   
- Depends: now.
--   
filterE :: forall a s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: now.
--   
notYet :: forall s e (m :: Type -> Type) a. Wire s e m (Event a) (Event a)

-- | Forget all occurrences except the first.
--   
--   
--   
- Depends: now when occurring.
--   
once :: forall s e (m :: Type -> Type) a. Wire s e m (Event a) (Event a)

-- | Forget all but the first given number of occurrences.
--   
--   
--   
- Depends: now.
--   
takeE :: forall s e (m :: Type -> Type) a. Int -> Wire s e m (Event a) (Event a)

-- | Forget all but the initial occurrences for which the given predicate
--   is true.
--   
--   
--   
- Depends: now.
--   
takeWhileE :: forall a s e (m :: Type -> Type). (a -> Bool) -> Wire s e m (Event a) (Event a)

-- | Left scan for events. Each time an event occurs, apply the given
--   function.
--   
--   
--   
- Depends: now.
--   
accumE :: forall b a s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: now.
--   
accum1E :: forall a s e (m :: Type -> Type). (a -> a -> a) -> Wire s e m (Event a) (Event a)

-- | On each occurrence, apply the function the event carries.
--   
--   
--   
- Depends: now.
--   
iterateE :: forall a s e (m :: Type -> Type). a -> Wire s e m (Event (a -> a)) (Event a)

-- | Maximum of all events.
--   
--   
--   
- Depends: now.
--   
maximumE :: forall a s e (m :: Type -> Type). Ord a => Wire s e m (Event a) (Event a)

-- | Minimum of all events.
--   
--   
--   
- Depends: now.
--   
minimumE :: forall a s e (m :: Type -> Type). Ord a => Wire s e m (Event a) (Event a)

-- | Product of all events.
--   
--   
--   
- Depends: now.
--   
productE :: forall a s e (m :: Type -> Type). Num a => Wire s e m (Event a) (Event a)

-- | Sum of all events.
--   
--   
--   
- Depends: now.
--   
sumE :: forall a s e (m :: Type -> Type). Num a => Wire s e m (Event a) (Event a)

module Control.Wire.Switch

-- | Acts like the first wire until it inhibits, then switches to the
--   second wire. Infixr 1.
--   
--   
--   
- Depends: like current wire.
--   
- Inhibits: after switching like the second wire.
--   
- Switch: now.
--   
(-->) :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Depends: like current wire.
--   
- Inhibits: after switching like the second wire.
--   
- Switch: now.
--   
(>--) :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Complexity: O(n * log n) space, O(log n) lookup time on switch wrt
--   number of started, inactive modes.
--   
- Depends: like currently active wire (left), now (right).
--   
- Inhibits: when active wire inhibits.
--   
- Switch: now on mode change.
--   
modes :: forall (m :: Type -> Type) k s e a b. (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.
--   
--   
--   
- Inhibits: like argument wire until switch, then like the new
--   wire.
--   
- Switch: once, now, restart state.
--   
switch :: forall (m :: Type -> Type) s e a b. (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.
--   
--   
--   
- Inhibits: like argument wire until switch, then like the new
--   wire.
--   
- Switch: once, after now, restart state.
--   
dSwitch :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Inhibits: like the first argument wire, like the new wire after
--   switch. Inhibition of the second argument wire is ignored.
--   
- Switch: once, now, restart state.
--   
kSwitch :: forall (m :: Type -> Type) s e a b. (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.
--   
--   
--   
- Inhibits: like the first argument wire, like the new wire after
--   switch. Inhibition of the second argument wire is ignored.
--   
- Switch: once, after now, restart state.
--   
dkSwitch :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Inhibits: like the current wire.
--   
- Switch: recurrent, now, restart state.
--   
rSwitch :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Inhibits: like the current wire.
--   
- Switch: recurrent, after now, restart state.
--   
drSwitch :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Depends: like current wire.
--   
- Inhibits: like the argument wires.
--   
- Switch: once, now, restart state.
--   
alternate :: forall (m :: Type -> Type) s e a b x. 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.
--   
--   
--   
- Inhibits: like the current wire.
--   
- Switch: recurrent, now, restart state.
--   
krSwitch :: forall (m :: Type -> Type) s e a b. 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.
--   
--   
--   
- Inhibits: like the current wire.
--   
- Switch: recurrent, after now, restart state.
--   
dkrSwitch :: forall (m :: Type -> Type) s e a b. 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.Interval

-- | Inhibit forever with the given value.
--   
--   
--   
- Inhibits: always.
--   
inhibit :: forall e s (m :: Type -> Type) a b. e -> Wire s e m a b

-- | After the given time period.
--   
--   
--   
- Depends: now after the given time period.
--   
- Inhibits: for the given time period.
--   
after :: forall t s e (m :: Type -> Type) a. (HasTime t s, Monoid e) => t -> Wire s e m a a

-- | For the given time period.
--   
--   
--   
- Depends: now for the given time period.
--   
- Inhibits: after the given time period.
--   
for :: forall t s e (m :: Type -> Type) a. (HasTime t s, Monoid e) => t -> Wire s e m a a

-- | When the given predicate is false for the input signal.
--   
--   
--   
- Depends: now.
--   
- Inhibits: unless the predicate is false.
--   
unless :: forall e a s (m :: Type -> Type). Monoid e => (a -> Bool) -> Wire s e m a a

-- | When the given predicate is true for the input signal.
--   
--   
--   
- Depends: now.
--   
- Inhibits: when the predicate is false.
--   
when :: forall e a s (m :: Type -> Type). Monoid e => (a -> Bool) -> Wire s e m a a

-- | Alias for hold.
asSoonAs :: forall e s (m :: Type -> Type) a. Monoid e => Wire s e m (Event a) a

-- | Start each time the left event occurs, stop each time the right event
--   occurs.
--   
--   
--   
- Depends: now when active.
--   
- Inhibits: after the right event occurred, before the left event
--   occurs.
--   
between :: forall e s (m :: Type -> Type) a b c. 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.
--   
--   
--   
- Depends: now.
--   
- Inhibits: until the event occurs for the first time.
--   
hold :: forall e s (m :: Type -> Type) a. 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.
--   
--   
--   
- Depends: now.
--   
- Inhibits: when no event occurred for the given amount of
--   time.
--   
holdFor :: forall t s e (m :: Type -> Type) a. (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.
--   
--   
--   
- Depends: now until event occurs.
--   
- Inhibits: forever after event occurs.
--   
until :: forall e s (m :: Type -> Type) a b. Monoid e => Wire s e m (a, Event b) a

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)
--   
--   
Examples
--   
--   
--   >>> fmap (+1) (Identity 0)
--   Identity 1
--   
--   
--   
--   >>> Identity [1, 2, 3] <> Identity [4, 5, 6]
--   Identity [1,2,3,4,5,6]
--   
--   
--   
--   >>> do
--         x <- Identity 10
--         y <- Identity (x + 5)
--         pure (x + y)
--   Identity 25
--   
newtype Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a

-- | This is a length of time, as measured by UTC. It has a precision of
--   10^-12 s.
--   
--   Conversion functions such as fromInteger and realToFrac
--   will treat it as seconds. For example, (0.010 ::
--   NominalDiffTime) corresponds to 10 milliseconds.
--   
--   It has a precision of one picosecond (= 10^-12 s). Enumeration
--   functions will treat it as picoseconds.
--   
--   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.Move

-- | Time derivative of the input signal.
--   
--   
--   
- Depends: now.
--   
- Inhibits: at singularities.
--   
derivative :: forall a t s e (m :: Type -> Type). (RealFloat a, HasTime t s, Monoid e) => Wire s e m a a

-- | Integrate the input signal over time.
--   
--   
--   
- Depends: before now.
--   
integral :: forall a t s e (m :: Type -> Type). (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.
--   
--   
--   
- Depends: before now.
--   
integralWith :: forall a t s w e (m :: Type -> Type). (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 :: forall t s b g e (m :: Type -> Type) a. (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 :: forall t s b g e (m :: Type -> Type) a. (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. =)
--   
--   
--   
- Depends: now.
--   
wackelkontakt :: forall t s (m :: Type -> Type) e g a. (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 :: forall t s b e (m :: Type -> Type) a. (HasTime t s, Random b) => t -> Int -> Wire s e m a (Event b)

-- | Convenience interface to noiseR for StdGen.
stdNoiseR :: forall t s (m :: Type -> Type) b e a. (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 :: forall t s (m :: Type -> Type) e a. (HasTime t s, Monad m, Monoid e) => t -> Double -> Int -> Wire s e m a a

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.Internal.Data.Data.Data t, GHC.Internal.Data.Data.Data a, GHC.Classes.Ord t) => GHC.Internal.Data.Data.Data (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 GHC.Internal.Base.Functor (FRP.Netwire.Utils.Timeline.Timeline t)
instance (GHC.Classes.Ord t, GHC.Classes.Ord a) => GHC.Classes.Ord (FRP.Netwire.Utils.Timeline.Timeline t a)
instance (GHC.Classes.Ord t, GHC.Internal.Read.Read t, GHC.Internal.Read.Read a) => GHC.Internal.Read.Read (FRP.Netwire.Utils.Timeline.Timeline t a)
instance (GHC.Internal.Show.Show t, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (FRP.Netwire.Utils.Timeline.Timeline t a)

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
--   
--   
--   
- Complexity: O(s) space, O(s) time wrt number of samples in the
--   interval.
--   
- Depends: now.
--   
lAvg :: forall a t s e (m :: Type -> Type). (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.
--   
--   
--   
- Complexity: O(s) space, O(n * log s) time, where s = number of
--   samples in the interval, n = number of requested data points.
--   
- Depends: now.
--   
lGraph :: forall a t s e (m :: Type -> Type). (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.
--   
--   
--   
- Complexity: O(s) space, O(n * log s) time, where s = number of
--   samples in the interval, n = number of requested data points.
--   
- Depends: now.
--   
lGraphN :: forall a t s e (m :: Type -> Type). (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
--   
--   
--   
- Complexity: O(s) space, O(s) time wrt number of samples in the
--   interval.
--   
- Depends: now.
--   
sAvg :: forall a t s e (m :: Type -> Type). (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.
--   
--   
--   
- Complexity: O(s) space, O(n * log s) time, where s = number of
--   samples in the interval, n = number of requested data points.
--   
- Depends: now.
--   
sGraph :: forall t s e (m :: Type -> Type) 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 sGraph.
--   
--   See also lGraphN.
--   
--   
--   
- Complexity: O(s) space, O(n * log s) time, where s = number of
--   samples in the interval, n = number of requested data points.
--   
- Depends: now.
--   
sGraphN :: forall t s e (m :: Type -> Type) a. (Fractional t, HasTime t s) => t -> Int -> Wire s e m a [a]

-- | High peak.
--   
--   
--   
- Depends: now.
--   
highPeak :: forall a s e (m :: Type -> Type). Ord a => Wire s e m a a

-- | High peak with respect to the given comparison function.
--   
--   
--   
- Depends: now.
--   
highPeakBy :: forall a s e (m :: Type -> Type). (a -> a -> Ordering) -> Wire s e m a a

-- | Low peak.
--   
--   
--   
- Depends: now.
--   
lowPeak :: forall a s e (m :: Type -> Type). Ord a => Wire s e m a a

-- | Low peak with respect to the given comparison function.
--   
--   
--   
- Depends: now.
--   
lowPeakBy :: forall a s e (m :: Type -> Type). (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.
--   
--   
--   
- Complexity: O(n) time and space wrt number of samples.
--   
avgFps :: forall b t s e (m :: Type -> Type) a. (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.
--   
--   
--   
- Inhibits: when the clock stopped ticking.
--   
framerate :: forall b t s e (m :: Type -> Type) a. (Eq b, Fractional b, HasTime t s, Monoid e) => Wire s e m a b

module FRP.Netwire

-- | A wire is a signal function. It maps a reactive value to another
--   reactive value.
data Wire s e (m :: Type -> Type) 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.
--   
--   
--   
- Depends: before now.
--   
delay :: forall a s e (m :: Type -> Type). a -> Wire s e m a a

-- | Evaluate the input signal using the given Strategy here. This
--   wire evaluates only produced values.
--   
--   
--   
- Depends: now.
--   
evalWith :: forall a s e (m :: Type -> Type). Strategy a -> Wire s e m a a

-- | Force the input signal to WHNF here. This wire forces both produced
--   values and inhibition values.
--   
--   
--   
- Depends: now.
--   
force :: forall s e (m :: Type -> Type) a. Wire s e m a a

-- | Force the input signal to NF here. This wire forces only produced
--   values.
--   
--   
--   
- Depends: now.
--   
forceNF :: forall a s e (m :: Type -> Type). NFData a => Wire s e m a a
