-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Monadic FRP library based on stm -- -- Read the homepage for more information. @package Updater @version 0.3 module Updater.Internal -- | Push based Updater. newtype Event a Event :: Updater a -> Event a [getEvent'] :: Event a -> Updater a -- | Pull based Updater newtype Behavior a Behavior :: Updater a -> Behavior a [getBehavior'] :: Behavior a -> Updater a -- | This monad works very similar to a continuation monad on top of stm. -- You can do any basic stm computation you want simply using -- liftSTM. However, if you use getEvent everything -- after that call will be executed everytime the Signal given to -- getEvent is changed. -- -- You can also use the Alternative instance to make a union of -- events. -- -- You can also use the Applicative instance to run two things -- 'parallel'. Parallel meaning that events on one side will not cause -- the other side to be reevaluated completely. newtype Updater a Updater :: ((a -> DownState -> IO UpState) -> DownState -> IO UpState) -> Updater a [runUpdater'] :: Updater a -> (a -> DownState -> IO UpState) -> DownState -> IO UpState newEvent' :: IO (Updater a, a -> IO ()) cacheStateless' :: Updater a -> Updater (Updater a) cacheStateful' :: Updater a -> Updater (Updater a) runUpdater :: Updater (Either (IO ()) res) -> IO res -- | Don't execute the io-action returned by newEvent. Also, fork; -- don't block. unsafeLiftIO :: IO a -> Behavior a -- | Just for some quick debugging -- --
--   putLine = unsafeLiftIO . putStrLn
--   
debug :: String -> Behavior () -- | This can be useful to spot when listeners are removed. debugCleanup :: String -> Behavior () onCommit :: IO () -> Behavior () justOne :: Updater a -> Updater a data UpState UpState :: IO () -> IO () -> UpState [stateOnCleanup] :: UpState -> IO () [stateOnCommit] :: UpState -> IO () data DownState DownState :: DownState instance GHC.Base.Monad Updater.Internal.Event instance GHC.Base.Alternative Updater.Internal.Event instance GHC.Base.Applicative Updater.Internal.Event instance GHC.Base.Functor Updater.Internal.Event instance Control.Monad.Fix.MonadFix Updater.Internal.Behavior instance GHC.Base.Monad Updater.Internal.Behavior instance GHC.Base.Applicative Updater.Internal.Behavior instance GHC.Base.Functor Updater.Internal.Behavior instance GHC.Base.Monoid Updater.Internal.UpState instance Control.Monad.Fix.MonadFix Updater.Internal.Updater instance GHC.Base.Applicative Updater.Internal.Updater instance GHC.Base.Alternative Updater.Internal.Updater instance GHC.Base.Monad Updater.Internal.Updater instance GHC.Base.Functor Updater.Internal.Updater module Updater -- | Push based Updater. data Event a -- | Pull based Updater data Behavior a newEvent :: IO (Event a, a -> IO ()) -- | The input will only be evaluated once, no matter how often the ouput -- Event is used. Since it is stateful, when the output -- Event is used, it will immediately continue with the last Event -- it received if such an event exists. cacheStateful :: Event a -> Behavior (Event a) -- | The input will only be evaluated once, no matter how often the output -- Event is used. Since it is stateless, when the output -- Event is used, it will first have to wait for events. cacheStateless :: Event a -> Behavior (Event a) -- | This can be thought of as polling a behavior. It will only fire once. sample :: Behavior a -> Event a -- | This can be implemented using mfix, cacheStateful, ... -- -- If you get into trouble and really need multiple recursively defined -- Events you can use mfix to do that. You should however look at the -- implementation of foldEvent and the SlotMachine example first. -- In particular, make sure you understande that you need to use 'sample -- . hold' on the recursive signal in order to avoid infinite recursion. foldEvent :: (b -> a -> b) -> b -> Event a -> Event b -- | 'Left io' events will be executed. The first 'Right res' event will -- end the function and return res. runEvent :: Event (Either (IO ()) res) -> IO res -- | This is just a convenience for use in ghci and in the test cases. It -- will just run the Event it is given in it's own thread. runGlobalEvent :: Event (IO ()) -> IO () -- | Just for some quick debugging -- --
--   putLine = unsafeLiftIO . putStrLn
--   
debug :: String -> Behavior () -- | This can be useful to spot when listeners are removed. debugCleanup :: String -> Behavior () -- | This just only forwards the first event It is probably most useful for -- Events crated using cacheStateful hold :: Event a -> Behavior a -- | Don't execute the io-action returned by newEvent. Also, fork; -- don't block. unsafeLiftIO :: IO a -> Behavior a instance GHC.Base.Monoid (Updater.Internal.Event a)