-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An Arrow based Functional Reactive Programming library -- -- Timeless aims to be a comprehensive FRP framework. Version 1 tries to -- build a system like the book Functional Reactive Programming @package timeless @version 1.0.1.2 module FRP.Timeless.Internal.Signal data Signal m a b [SId] :: Signal m a a [SConst] :: Maybe b -> Signal m a b [SArr] :: (Maybe a -> Maybe b) -> Signal m a b [SPure] :: (Maybe a -> (Maybe b, Signal m a b)) -> Signal m a b [SGen] :: (Monad m) => (Maybe a -> m (Maybe b, Signal m a b)) -> Signal m a b -- | Steps a signal in certain time step stepSignal :: (Monad m) => Signal m a b -> Maybe a -> m (Maybe b, Signal m a b) -- | Left strict tuple lstrict :: (a, b) -> (a, b) instance GHC.Base.Monad m => Control.Category.Category (FRP.Timeless.Internal.Signal.Signal m) instance GHC.Base.Monad m => Control.Arrow.Arrow (FRP.Timeless.Internal.Signal.Signal m) instance GHC.Base.Monad m => Control.Arrow.ArrowChoice (FRP.Timeless.Internal.Signal.Signal m) instance Control.Monad.Fix.MonadFix m => Control.Arrow.ArrowLoop (FRP.Timeless.Internal.Signal.Signal m) instance GHC.Base.Monad m => GHC.Base.Functor (FRP.Timeless.Internal.Signal.Signal m a) instance GHC.Base.Monad m => GHC.Base.Applicative (FRP.Timeless.Internal.Signal.Signal m a) -- | Maintainer: Rongcui Dong karl_1702@188.com module FRP.Timeless.Run -- | This function runs the given signal network using the given state -- delta generator. It constantly shows the output of the wire on one -- line on stdout. Press Ctrl-C to abort. testSignal :: (MonadIO m, Show b) => (forall a. Signal Identity a b) -> m c -- | This command drives a black box of signal network. The driver knows -- nothing about the internals of the network, only stops when the -- network is inhibited. runBox :: (Monad m) => Signal m () () -> m () -- | This module contains the lowest level primitives of timeless, directly -- working with the Signal arrow. Try not to use them as they tend to be -- very hard to grasp. Use them only when building a new FRP framework. -- -- Understand that using Signal directly can be difficult to -- reason about module FRP.Timeless.Internal.Prefab.Primitive -- | Make a signal that inhibits forever mkEmpty :: Signal m a b -- | The Identity Signal mkId :: Signal m a a -- | Make a constant Signal mkConst :: Maybe b -> Signal m a b -- | Make a pure stateful signal from given transition function mkPure :: (a -> (Maybe b, Signal m a b)) -> Signal m a b -- | Make a stateful signal from given (Monadic) transition function mkGen :: (Monad m) => (a -> m (Maybe b, Signal m a b)) -> Signal m a b -- | Make a pure stateless signal from given function mkPure_ :: (a -> (Maybe b)) -> Signal m a b -- | Make a pure stateful signal from given signal function mkSF :: (a -> (b, Signal m a b)) -> Signal m a b -- | Make a pure stateless signal from given signal function mkSF_ :: (a -> b) -> Signal m a b -- | Make a stateful wire from chained state transition function. Notice -- that the output will always be the new value mkSW_ :: b -> (b -> a -> b) -> Signal m a b -- | Make a stateless signal from given function mkGen_ :: (Monad m) => (a -> m (Maybe b)) -> Signal m a b -- | Make a stateless signal from Kleisli function mkKleisli_ :: (Monad m) => (a -> m b) -> Signal m a b -- | Make a stateful signal from Kleisli function mkSK_ :: (Monad m) => b -> (b -> a -> m b) -> Signal m a b -- | Make a monadic constant wire mkConstM :: (Monad m) => m b -> Signal m a b -- | Make a monadic action wire, alias for mkConstM mkActM :: (Monad m) => m b -> Signal m a b delay :: a -> Signal m a a module FRP.Timeless.Internal.Prefab module FRP.Timeless type Signal a b = Signal IO a b -- | A Stream of discrete events. type Stream a b = Signal (Maybe a) (Maybe b) -- | A Source of discrete event type StreamSource b = Signal () (Maybe b) -- | A Sink of discrete event type StreamSink a = Signal (Maybe a) () -- | A Source of discrete event type CellSource b = Signal () b -- | A Sink of discrete event type CellSink a = Signal a () -- | A Cell of continuous value. -- -- Cells must not be inhibited type Cell a b = Signal a b type StreamCell a b = Signal (Maybe a) b arrS :: (a -> b) -> Stream a b -- | A StreamSource that never fires neverS :: StreamSource b -- | A StreamSource that fires only ones onceS :: b -> StreamSource b delay :: a -> Signal m a a sourceC :: IO b -> CellSource b sinkC :: (a -> IO ()) -> CellSink a sourceS :: IO (Maybe b) -> StreamSource b sinkS :: (a -> IO ()) -> StreamSink a -- | Merges two Stream. When simultaneous, use the merge function mergeS :: ((a, a) -> a) -> Signal (Maybe a, Maybe a) (Maybe a) -- | Merges two Stream with precedence to first. P stands for -- Priority mergeSP :: Signal (Maybe b, Maybe b) (Maybe b) -- | Holds a discrete value to be continuous. An initial value must be -- given hold :: a -> StreamCell a a -- | Filters stream of event. TODO: In future, might implement -- Foldable filterS :: (a -> Bool) -> Stream a a filterSM :: Stream (Maybe a) a -- | Takes a snapshot of b when an event a comes. Meanwhile, transform the -- Stream with the Cell value snapshot :: ((a, b) -> c) -> Signal (Maybe a, b) (Maybe c) -- | This conviniently just samples a Cell sample :: Signal (Maybe a, b) (Maybe b) -- | A state block, updates on event. Note that this can be constructed -- with Signal directly, but we are using primitives instead, for -- easy reasoning state :: s -> ((a, s) -> s) -> StreamCell a s zipS :: Signal m (Maybe a, Maybe b) (Maybe (a, b)) zipS3 :: Signal m (Maybe a, Maybe b, Maybe c) (Maybe (a, b, c)) zipS4 :: Signal m (Maybe a, Maybe b, Maybe c, Maybe d) (Maybe (a, b, c, d)) zipS5 :: Signal m (Maybe a, Maybe b, Maybe c, Maybe d, Maybe e) (Maybe (a, b, c, d, e)) zipS6 :: Signal m (Maybe a, Maybe b, Maybe c, Maybe d, Maybe e, Maybe f) (Maybe (a, b, c, d, e, f)) zipS7 :: Signal m (Maybe a, Maybe b, Maybe c, Maybe d, Maybe e, Maybe f, Maybe g) (Maybe (a, b, c, d, e, f, g))