-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An Arrow based Functional Reactive Programming library -- -- Timeless is based on a almost completely rewriten Netwire 5 core, plus -- numerous (not yet for now) extensions to provide an extensive library -- for Arrowrized Functional Reactive Programming with continuous time -- semantics. @package timeless @version 0.8.1.0 module FRP.Timeless.Session -- | State delta types with time deltas. You can extract fractionals using -- realToFrac 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 s Session :: m (s, Session m s) -> Session m s [stepSession] :: Session m 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 :: (MonadIO m) => Session m (s -> Timed NominalDiffTime s) -- | Non-extending version of clockSession. clockSession_ :: (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 :: (Applicative m) => t -> Session m (s -> Timed t s) -- | Non-extending version of countSession. countSession_ :: (Applicative m) => t -> Session m (Timed t ()) instance Data.Traversable.Traversable (FRP.Timeless.Session.Timed t) instance (GHC.Show.Show t, GHC.Show.Show s) => GHC.Show.Show (FRP.Timeless.Session.Timed t s) instance (GHC.Read.Read t, GHC.Read.Read s) => GHC.Read.Read (FRP.Timeless.Session.Timed t s) instance (GHC.Classes.Ord t, GHC.Classes.Ord s) => GHC.Classes.Ord (FRP.Timeless.Session.Timed t s) instance GHC.Base.Functor (FRP.Timeless.Session.Timed t) instance Data.Foldable.Foldable (FRP.Timeless.Session.Timed t) instance (GHC.Classes.Eq t, GHC.Classes.Eq s) => GHC.Classes.Eq (FRP.Timeless.Session.Timed t s) instance (Data.Data.Data t, Data.Data.Data s) => Data.Data.Data (FRP.Timeless.Session.Timed t s) instance GHC.Base.Functor m => GHC.Base.Functor (FRP.Timeless.Session.Session m) instance GHC.Base.Applicative m => GHC.Base.Applicative (FRP.Timeless.Session.Session m) instance (GHC.Base.Monoid s, GHC.Real.Real t) => FRP.Timeless.Session.HasTime t (FRP.Timeless.Session.Timed t s) instance (GHC.Base.Monoid s, GHC.Num.Num t) => GHC.Base.Monoid (FRP.Timeless.Session.Timed t s) module FRP.Timeless.Signal data Signal s m a b SId :: Signal s m a a SConst :: Maybe b -> Signal s m a b SArr :: (Maybe a -> Maybe b) -> Signal s m a b SPure :: (s -> Maybe a -> (Maybe b, Signal s m a b)) -> Signal s m a b SGen :: (s -> Maybe a -> m (Maybe b, Signal s m a b)) -> Signal s m a b -- | Steps a signal in certain time step stepSignal :: (Monad m) => Signal s m a b -> s -> Maybe a -> m (Maybe b, Signal s m a b) -- | Left strict tuple lstrict :: (a, b) -> (a, b) instance GHC.Base.Monad m => Control.Category.Category (FRP.Timeless.Signal.Signal s m) instance GHC.Base.Monad m => Control.Arrow.Arrow (FRP.Timeless.Signal.Signal s m) instance GHC.Base.Monad m => Control.Arrow.ArrowChoice (FRP.Timeless.Signal.Signal s m) instance Control.Monad.Fix.MonadFix m => Control.Arrow.ArrowLoop (FRP.Timeless.Signal.Signal s m) instance GHC.Base.Monad m => GHC.Base.Functor (FRP.Timeless.Signal.Signal s m a) instance GHC.Base.Monad m => GHC.Base.Applicative (FRP.Timeless.Signal.Signal s 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) => Session m s -> (forall a. Signal s 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) => Session m s -> Signal s m () () -> m () module FRP.Timeless.Prefab.Primitive -- | Make a signal that inhibits forever mkEmpty :: Signal s m a b -- | The Identity Signal mkId :: Signal s m a a -- | Make a constant Signal mkConst :: Maybe b -> Signal s m a b -- | Make a pure stateful signal from given transition function mkPure :: (Monoid s) => (s -> a -> (Maybe b, Signal s m a b)) -> Signal s m a b -- | Make a stateful signal from given (Monadic) transition function mkGen :: (Monad m, Monoid s) => (s -> a -> m (Maybe b, Signal s m a b)) -> Signal s m a b -- | Make a pure stateful wire from given transition function mkPW :: (Monoid s) => (s -> a -> (b, Signal s m a b)) -> Signal s m a b -- | Make a pure stateful wire from given time independant transition -- function mkPWN :: (a -> (b, Signal s m a b)) -> Signal s m a b -- | Make a pure stateless wire from given function mkPW_ :: (a -> b) -> Signal s 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 s m a b -- | Make a pure stateful signal from given time independant transition -- function mkPureN :: (a -> (Maybe b, Signal s m a b)) -> Signal s m a b -- | Make a pure stateless signal from given function mkPure_ :: (a -> (Maybe b)) -> Signal s m a b -- | Make a stateful signal from given (Monadic) time independant -- transition function mkGenN :: (Monad m) => (a -> m (Maybe b, Signal s m a b)) -> Signal s m a b -- | Make a stateless signal from given function mkGen_ :: (Monad m) => (a -> m (Maybe b)) -> Signal s m a b -- | Make a stateless signal from Kleisli function mkKleisli_ :: (Monad m) => (a -> m b) -> Signal s m a b -- | Make a stateful signal from Kleisli function mkSK_ :: (Monad m) => b -> (b -> a -> m b) -> Signal s m a b -- | Make a monadic constant wire mkConstM :: (Monad m) => m b -> Signal s m a b -- | Make a monadic action wire, alias for mkConstM mkActM :: (Monad m) => m b -> Signal s 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. -- --
-- () `occursFor` 1 >>> <some IO actions> >>> snapOnce ---- -- The example above will perform the IO action once and then hold the -- result forever occursFor :: (Monad m) => b -> Int -> Signal s m a b -- | A value that appears for a semantically infinitely short period of -- time impulse :: (Monad m) => b -> Signal s m a b oneShot :: (Monad m) => b -> Signal s m a b -- | Takes the snapshot of the value when signal is activated, and then -- holds value forever -- -- Typical usage: -- --
-- () `occursFor` 1 >>> <some IO actions> >>> snapOnce ---- -- The example above will perform the IO action once and then hold the -- result forever snapOnce :: (Monad m) => Signal s m a a -- | Acts as identity for a several sample periods, then inhibits. inhibitsAfterPeriods :: Int -> Signal s m a a -- | Runs a signal once and hold the result forever. -- -- It is a combination of inhibitsAfter and snapOnce runAndHold :: (Monad m) => Signal s m a b -> Signal s m a b -- | Rising edge filter. Creates an impulse at rising edge rising :: (Monad m) => Bool -> Signal s m Bool Bool -- | Falling edge filter. Creates an impulse at falling edge falling :: (Monad m) => Bool -> Signal s m Bool Bool -- | Edge filter. Creates an impulse at edge edge :: (Monad m) => Bool -> Signal s m Bool Bool -- | A Set-Reset latch, with the first input set, second input reset. -- Current output value has higher priority (Prefer lazy!) latch :: (Monad m) => Bool -> Signal s m (Bool, Bool) Bool -- | A set-latch whose initial value is False, but turns True and holds -- when its input becomes true latchS :: (Monad m) => Signal s m Bool Bool -- | A reset-latch whose initial value is True, but turns False and holds -- when its input becomes false latchR :: (Monad m) => Signal s m Bool Bool module FRP.Timeless.Prefab.Switch -- | Immediately switches to the second signal after the first one -- inhibits, and never switch back. Second signal is untouched until -- first signal inhibits (-->) :: (Monad m) => Signal s m a b -> Signal s m a b -> Signal s m a b -- | The flipped (-->) (<--) :: (Monad m) => Signal s m a b -> Signal s m a b -> Signal s m a b -- | Immediately switches to the second signal when it starts to produce -- output, and never switches back. First signal is untouched after -- second starts producing (--<) :: (Monad m) => Signal s m a b -> Signal s m a b -> Signal s m a b -- | The flipped (--<) (>--) :: (Monad m) => Signal s m a b -> Signal s m a b -> Signal s m a b -- | Copyright: (c) 2015 Rongcui Dong License: BSD3 Maintainer: Rongcui -- Dong karl_1702@188.com module FRP.Timeless.Prefab.Utils -- | Local time starting from zero. time :: (HasTime t s) => Signal s m a t -- | Local time starting from zero, converted to your favorite fractional -- type. timeF :: (Fractional b, HasTime t s, Monad m) => Signal s m a b -- | Local time starting from the given value. timeFrom :: (HasTime t s) => t -> Signal s m a t -- | A signal for easy debugging in arrow environment sDebug :: (MonadIO m) => Signal s m String () module FRP.Timeless.Prefab -- | Copyright: (c) 2015 Rongcui Dong License: BSD3 Maintainer: Rongcui -- Dong karl_1702@188.com module FRP.Timeless -- | Sorry, I thought haddock will process LHS automatically, but -- apparently it does not -- -- Module: FRP.Timeless.Tutorial Copyright: (c) 2015 Rongcui Dong -- License: BSD3 Maintainer: Rongcui Dong karl_1702@188.com module FRP.Timeless.Tutorial initConsole :: IO () runEcho :: IO () inputBlocking :: IO Char sInput :: Signal s IO () Char output :: Char -> IO () sOutput :: Signal s IO Char () sEchoBox :: Signal s IO () () runEcho2 :: IO () inputNonBlocking :: IO (Maybe Char) outputMay :: Maybe Char -> IO () sInput' :: Signal s IO () (Maybe Char) sOutput' :: Signal s IO (Maybe Char) () sEchoBox2 :: Signal s IO () () runGetName :: IO () updateName :: String -> Maybe Char -> String sName :: (Monad m) => Signal s m (Maybe Char) String sReverse :: (Monad m) => Signal s m String String sLineOut :: Signal s IO String () sNameBox :: Signal s IO () () runHello :: IO () hello :: String -> String sHello :: (Monad m) => Signal s m String String sHelloBox :: Signal s IO () () runGreetings :: IO () sIsReturn :: (Monad m) => Signal s m (Maybe Char) Bool sName2 :: (Monad m) => Signal s m (Bool, String) String sGreeting :: (Monad m) => Signal s m String String sGreetingsBox :: Signal s IO () () runTutorial :: IO () sQuit :: (Monad m) => Signal s m String () sTutorialBox :: Signal s IO () () module FRP.Timeless.Framework.Console data InitConfig InitConfig :: Handle -> Handle -> Bool -> BufferMode -> BufferMode -> Bool -> InitConfig [initInHandle] :: InitConfig -> Handle [initOutHandle] :: InitConfig -> Handle [initEcho] :: InitConfig -> Bool [initInBuffering] :: InitConfig -> BufferMode [initOutBuffering] :: InitConfig -> BufferMode [initShowCursor] :: InitConfig -> Bool defaultInitConfig :: InitConfig -- | Initializes console initConsole :: InitConfig -> IO () -- | Draw a filled ascii box with specified color and size. It will destroy -- SGR color state, be careful asciiBox :: Int -> Int -> ColorIntensity -> Color -> IO () -- | Draw a character at a specific position. It will destroy SGR color -- state drawChar :: Char -> Int -> Int -> ColorIntensity -> Color -> IO () -- | Statefully draw character drawCharS :: Char -> ColorIntensity -> Color -> (Int, Int) -> (Int, Int) -> IO (Int, Int) -- | Clears a certain column range on a certain row clearLineRange :: Int -> Int -> Int -> IO () -- | Gets character input from console without blocking sInputNonBlocking :: Signal s IO () (Maybe Char) module FRP.Timeless.Tutorial2 sInput :: Signal s IO () (Maybe Char) -- | Draws a vivid white ^ on the bottom line, and deals with -- flickering drawPlayer :: Int -> Int -> IO Int testIO :: IO () data Move MLeft :: Move MRight :: Move MStay :: Move -- | Updates an X coordinate updatePosX :: (Num a, Ord a) => a -> Move -> a -- | The stateful signal of player X coordinate sPlayerX :: (Monad m) => Signal s m Move Int -- | Convert a keypress to Move toMove :: Maybe Char -> Move testPlayer :: IO () data EnemyEvent EKill :: EnemyEvent ENoevent :: EnemyEvent data Enemy Enemy :: Point V2 Int -> V2 Int -> Double -> Bool -> Enemy -- | Enemy Position [ePos] :: Enemy -> Point V2 Int -- | Direction vector [eDir] :: Enemy -> V2 Int -- | Speed, affecting update interval [eSpeed] :: Enemy -> Double -- | Is it alive? [eAlive] :: Enemy -> Bool -- | Modeling the change of position dPos :: (HasTime t s) => s -> V2 Double -> V2 Double -- | Main signal to update an enemy sUpdateEnemy0 :: (Monad m, HasTime t s) => Enemy -> Signal s m EnemyEvent Enemy testEnemy0 :: IO () data Player Player :: Point V2 Int -> Bool -> Player -- | Position [playerPos] :: Player -> Point V2 Int -- | Whether player is firing bullets [playerFiring] :: Player -> Bool data PlayerEvent PMoveL :: PlayerEvent PMoveR :: PlayerEvent PFire :: PlayerEvent PNoevent :: PlayerEvent -- | Just a wrapper around updatePosX updatePosX' :: (Num a, Ord a) => a -> PlayerEvent -> a -- | Interface PlayerEvent to logic signal sToFire :: Monad m => Signal s m PlayerEvent Bool -- | The logic signal to handle fire and cooldown sFire :: (HasTime t s, Monad m) => Signal s m Bool Bool -- | The signal to update player sUpdatePlayer :: (Monad m, HasTime t s) => Player -> Signal s m PlayerEvent Player -- | Converts a raw input to a PlayerEvent toPlayerEvent :: Maybe Char -> PlayerEvent testPlayer2 :: IO () data Bullet Bullet :: Point V2 Int -> V2 Int -> Bool -> Bullet [bulletPos] :: Bullet -> Point V2 Int [bulletVel] :: Bullet -> V2 Int [bulletIsDestroyed] :: Bullet -> Bool data BulletEvent BDestroy :: BulletEvent BNoevent :: BulletEvent sUpdateBullet :: (Monad m, HasTime t s) => Bullet -> Signal s m BulletEvent Bullet -- | The signal of position in a boundary sUpdateBoundedPosition :: (MonadFix m, HasTime t s) => Point V2 Double -> V2 Double -> V2 Int -> Signal s m a (Point V2 Double) -- | Testing sUpdateBoundedPosition testUBP :: IO () -- | The signal to update an enemy sUpdateEnemy :: (MonadFix m, HasTime t s) => Enemy -> V2 Int -> Signal s m EnemyEvent Enemy testEnemy :: IO () instance GHC.Show.Show FRP.Timeless.Tutorial2.PlayerEvent instance GHC.Show.Show FRP.Timeless.Tutorial2.Move instance GHC.Show.Show FRP.Timeless.Tutorial2.Enemy instance GHC.Show.Show FRP.Timeless.Tutorial2.Player instance GHC.Show.Show FRP.Timeless.Tutorial2.Bullet