Copyright | (c) 2013 Ertugrul Soeylemez |
---|---|
License | BSD3 |
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
Safe Haskell | None |
Language | Haskell2010 |
- data Wire s e m a b where
- stepWire :: Monad m => Wire s e m a b -> s -> Either e a -> m (Either e b, Wire s e m a b)
- mkConst :: Either e b -> Wire s e m a b
- mkEmpty :: 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 :: Wire s e m a a
- mkPure :: Monoid s => (s -> a -> (Either e b, Wire s e m a b)) -> Wire s e m a b
- mkPure_ :: (a -> Either e b) -> Wire s e m a b
- mkPureN :: (a -> (Either e b, Wire s e m a b)) -> Wire s e m a b
- mkSF :: Monoid s => (s -> a -> (b, Wire s e m a b)) -> Wire s e m a b
- mkSF_ :: (a -> b) -> Wire s e m a b
- mkSFN :: (a -> (b, Wire s e m a b)) -> Wire s e m a b
- delay :: a -> Wire s e m a a
- evalWith :: Strategy a -> Wire s e m a a
- force :: Wire s e m a a
- forceNF :: 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 a'. m' a' -> m a') -> Wire s e m' a b -> Wire s e m a b
Wires
data Wire s e m a b where Source
A wire is a signal function. It maps a reactive value to another reactive value.
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 |
Monad m => Category * (Wire s e m) Source | |
Monad m => Arrow (Wire s e m) Source | |
(Monad m, Monoid e) => ArrowZero (Wire s e m) Source | |
(Monad m, Monoid e) => ArrowPlus (Wire s e m) Source | |
(Monad m, Monoid e) => ArrowChoice (Wire s e m) Source | |
MonadFix m => ArrowLoop (Wire s e m) Source | |
Monad m => Profunctor (Wire s e m) Source | |
(Monad m, Monoid e) => Choice (Wire s e m) Source | |
(Monad m, Monoid e) => Strong (Wire s e m) Source | |
Monad m => Functor (Wire s e m a) Source | |
Monad m => Applicative (Wire s e m a) Source | |
(Monad m, Monoid e) => Alternative (Wire s e m a) Source | |
(Monad m, Floating b) => Floating (Wire s e m a b) Source | |
(Monad m, Fractional b) => Fractional (Wire s e m a b) Source | |
(Monad m, Num b) => Num (Wire s e m a b) Source | |
(Monad m, IsString b) => IsString (Wire s e m a b) Source | |
(Monad m, Monoid b) => Monoid (Wire s e m a b) Source | |
(Monad m, Semigroup b) => Semigroup (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 :: Either e b -> Wire s e m a b Source
Construct a stateless wire from the given signal mapping function.
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 :: 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_ :: (a -> Either e b) -> Wire s e m a b Source
Construct a pure stateless wire from the given transition function.
mkPureN :: (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 :: 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.
mkSFN :: (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 :: 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 :: 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 :: 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 :: NFData a => Wire s e m a a Source
Force the input signal to NF here. This wire forces only produced values.
- Depends: now.