Copyright | (c) 2013 Ertugrul Soeylemez |
---|---|
License | BSD3 |
Maintainer | Ertugrul Soeylemez <[email protected]> |
Safe Haskell | None |
Language | Haskell2010 |
Control.Wire.Core
Description
Synopsis
- data Wire s e (m :: Type -> Type) a b where
- 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
- stepWire :: Monad m => Wire s e m a b -> s -> Either e a -> m (Either e b, Wire s e m a b)
- mkConst :: forall e b s (m :: Type -> Type) a. Either e b -> Wire s e m a b
- mkEmpty :: forall e s (m :: Type -> Type) a b. Monoid e => Wire s e m a b
- mkGen :: (Monad m, Monoid s) => (s -> a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b
- mkGen_ :: Monad m => (a -> m (Either e b)) -> Wire s e m a b
- mkGenN :: Monad m => (a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b
- mkId :: forall s e (m :: Type -> Type) a. Wire s e m a a
- 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
- mkPure_ :: forall a e b s (m :: Type -> Type). (a -> Either e b) -> Wire s e m a b
- 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
- 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
- mkSF_ :: forall a b s e (m :: Type -> Type). (a -> b) -> Wire s e m a b
- mkSFN :: forall a b s e (m :: Type -> Type). (a -> (b, Wire s e m a b)) -> Wire s e m a b
- delay :: forall a s e (m :: Type -> Type). a -> Wire s e m a a
- evalWith :: forall a s e (m :: Type -> Type). Strategy a -> Wire s e m a a
- force :: forall s e (m :: Type -> Type) a. Wire s e m a a
- forceNF :: forall a s e (m :: Type -> Type). NFData a => Wire s e m a a
- (&&&!) :: (a -> b) -> (a -> c) -> a -> (b, c)
- (***!) :: (a -> c) -> (b -> d) -> (a, b) -> (c, d)
- lstrict :: (a, b) -> (a, b)
- mapWire :: (Monad m', Monad m) => (forall a1. m' a1 -> m a1) -> Wire s e m' a b -> Wire s e m a b
Wires
data Wire s e (m :: Type -> Type) a b where Source #
A wire is a signal function. It maps a reactive value to another reactive value.
Constructors
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 |
Instances
Monad m => Category (Wire s e m :: Type -> Type -> Type) Source # | |
Monad m => Arrow (Wire s e m) Source # | |
Defined in Control.Wire.Core | |
(Monad m, Monoid e) => ArrowChoice (Wire s e m) Source # | |
Defined in Control.Wire.Core | |
MonadFix m => ArrowLoop (Wire s e m) Source # | |
Defined in Control.Wire.Core | |
(Monad m, Monoid e) => ArrowPlus (Wire s e m) Source # | |
(Monad m, Monoid e) => ArrowZero (Wire s e m) Source # | |
Defined in Control.Wire.Core | |
(Monad m, Monoid e) => Choice (Wire s e m) Source # | |
(Monad m, Monoid e) => Strong (Wire s e m) Source # | |
Monad m => Profunctor (Wire s e m) Source # | |
Defined in Control.Wire.Core Methods dimap :: (a -> b) -> (c -> d) -> Wire s e m b c -> Wire s e m a d # lmap :: (a -> b) -> Wire s e m b c -> Wire s e m a c # rmap :: (b -> c) -> Wire s e m a b -> Wire s e m a c # (#.) :: forall a b c q. Coercible c b => q b c -> Wire s e m a b -> Wire s e m a c # (.#) :: forall a b c q. Coercible b a => Wire s e m b c -> q a b -> Wire s e m a c # | |
(Monad m, Monoid e) => Alternative (Wire s e m a) Source # | |
Monad m => Applicative (Wire s e m a) Source # | |
Defined in Control.Wire.Core Methods pure :: a0 -> Wire s e m a a0 # (<*>) :: Wire s e m a (a0 -> b) -> Wire s e m a a0 -> Wire s e m a b # liftA2 :: (a0 -> b -> c) -> Wire s e m a a0 -> Wire s e m a b -> Wire s e m a c # (*>) :: Wire s e m a a0 -> Wire s e m a b -> Wire s e m a b # (<*) :: Wire s e m a a0 -> Wire s e m a b -> Wire s e m a a0 # | |
Monad m => Functor (Wire s e m a) Source # | |
(Monad m, IsString b) => IsString (Wire s e m a b) Source # | |
Defined in Control.Wire.Core Methods fromString :: String -> Wire s e m a b # | |
(Monad m, Monoid b) => Monoid (Wire s e m a b) Source # | |
(Monad m, Semigroup b) => Semigroup (Wire s e m a b) Source # | |
(Monad m, Floating b) => Floating (Wire s e m a b) Source # | |
Defined in Control.Wire.Core Methods exp :: Wire s e m a b -> Wire s e m a b # log :: Wire s e m a b -> Wire s e m a b # sqrt :: Wire s e m a b -> Wire s e m a b # (**) :: Wire s e m a b -> Wire s e m a b -> Wire s e m a b # logBase :: Wire s e m a b -> Wire s e m a b -> Wire s e m a b # sin :: Wire s e m a b -> Wire s e m a b # cos :: Wire s e m a b -> Wire s e m a b # tan :: Wire s e m a b -> Wire s e m a b # asin :: Wire s e m a b -> Wire s e m a b # acos :: Wire s e m a b -> Wire s e m a b # atan :: Wire s e m a b -> Wire s e m a b # sinh :: Wire s e m a b -> Wire s e m a b # cosh :: Wire s e m a b -> Wire s e m a b # tanh :: Wire s e m a b -> Wire s e m a b # asinh :: Wire s e m a b -> Wire s e m a b # acosh :: Wire s e m a b -> Wire s e m a b # atanh :: Wire s e m a b -> Wire s e m a b # log1p :: Wire s e m a b -> Wire s e m a b # expm1 :: Wire s e m a b -> Wire s e m a b # | |
(Monad m, Num b) => Num (Wire s e m a b) Source # | |
Defined in Control.Wire.Core Methods (+) :: Wire s e m a b -> Wire s e m a b -> Wire s e m a b # (-) :: Wire s e m a b -> Wire s e m a b -> Wire s e m a b # (*) :: Wire s e m a b -> Wire s e m a b -> Wire s e m a b # negate :: Wire s e m a b -> Wire s e m a b # abs :: Wire s e m a b -> Wire s e m a b # signum :: Wire s e m a b -> Wire s e m a b # fromInteger :: Integer -> Wire s e m a b # | |
(Monad m, Fractional b) => Fractional (Wire s e m a b) Source # | |
stepWire :: Monad m => Wire s e m a b -> s -> Either e a -> m (Either e b, Wire s e m a b) Source #
Perform one step of the given wire.
Constructing wires
mkConst :: forall e b s (m :: Type -> Type) a. Either e b -> Wire s e m a b Source #
Construct a stateless wire from the given signal mapping function.
mkEmpty :: forall e s (m :: Type -> Type) a b. Monoid e => Wire s e m a b Source #
Construct the empty wire, which inhibits forever.
mkGen :: (Monad m, Monoid s) => (s -> a -> m (Either e b, Wire s e m a b)) -> Wire s e m a b Source #
Construct a stateful wire from the given transition function.
mkGen_ :: Monad m => (a -> m (Either e b)) -> Wire s e m a b Source #
Construct a stateless 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 Source #
Construct a 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 Source #
Construct a pure stateful 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 Source #
Construct a pure stateless 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 Source #
Construct a pure stateful wire from the given transition 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 Source #
Construct a pure stateful wire from the given signal function.
mkSF_ :: forall a b s e (m :: Type -> Type). (a -> b) -> Wire s e m a b Source #
Construct a pure stateless wire from the given function.
mkSFN :: forall a b s e (m :: Type -> Type). (a -> (b, Wire s e m a b)) -> Wire s e m a b Source #
Construct a pure stateful wire from the given signal function.
Data flow and dependencies
delay :: forall a s e (m :: Type -> Type). a -> Wire s e m a a Source #
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.
evalWith :: forall a s e (m :: Type -> Type). Strategy a -> Wire s e m a a Source #
Evaluate the input signal using the given Strategy
here. This
wire evaluates only produced values.
- Depends: now.
force :: forall s e (m :: Type -> Type) a. Wire s e m a a Source #
Force the input signal to WHNF here. This wire forces both produced values and inhibition values.
- Depends: now.
forceNF :: forall a s e (m :: Type -> Type). NFData a => Wire s e m a a Source #
Force the input signal to NF here. This wire forces only produced values.
- Depends: now.