-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Rapid prototyping with GHCi: hot reloading of running components and reload-surviving values -- -- This package provides a rapid prototyping suite for GHCi that can be -- used standalone or integrated into editors. You can hot-reload -- individual running components as you make changes to their code. It is -- designed to shorten the development cycle during the development of -- long-running programs like servers, web applications and interactive -- user interfaces. -- -- It can also be used in the context of batch-style programs: Keep -- resources that are expensive to create in memory and reuse them across -- module reloads instead of reloading/recomputing them after every code -- change. -- -- Technically this package is a safe and convenient wrapper around -- foreign-store. @package rapid @version 0.1.3 -- | This module provides a rapid prototyping suite for GHCi that can be -- used standalone or integrated into editors. You can hot-reload -- individual running components as you make changes to their code. It is -- designed to shorten the development cycle during the development of -- long-running programs like servers, web applications and interactive -- user interfaces. -- -- It can also be used in the context of batch-style programs: Keep -- resources that are expensive to create in memory and reuse them across -- module reloads instead of reloading/recomputing them after every code -- change. -- -- Technically this package is a safe and convenient wrapper around -- foreign-store. -- -- Read the "Safety and securty" section before using this module! module Rapid -- | Handle to the current Rapid state. data Rapid k -- | Retrieve the current Rapid state handle, and pass it to the given -- continuation. If the state handle doesn't exist, it is created. The -- key type k is used for naming reloadable services like -- threads. -- -- Warning: The key type must not change during a session. If you -- need to change the key type, currently the safest option is to restart -- GHCi. -- -- This function uses the foreign-store library to establish a -- state handle that survives GHCi reloads and is suitable for hot -- reloading. -- -- The first argument is the Store index. If you do not use the -- foreign-store library in your development workflow, just use 0, -- otherwise use any unused index. rapid :: forall k r. Word32 -> (Rapid k -> IO r) -> IO r -- | Create a thread with the given name that runs the given action. -- -- The thread is restarted each time an update occurs. restart :: (Ord k) => Rapid k -> k -> IO () -> IO () -- | Create a thread with the given name that runs the given action. -- -- The thread is restarted each time an update occurs. -- -- The first argument is the function used to create the thread. It can -- be used to select between async, asyncBound and -- asyncOn. restartWith :: (Ord k) => (forall a. IO a -> IO (Async a)) -> Rapid k -> k -> IO () -> IO () -- | Create a thread with the given name that runs the given action. -- -- When an update occurs and the thread is currently not running, it is -- started. start :: (Ord k) => Rapid k -> k -> IO () -> IO () -- | Create a thread with the given name that runs the given action. -- -- When an update occurs and the thread is currently not running, it is -- started. -- -- The first argument is the function used to create the thread. It can -- be used to select between async, asyncBound and -- asyncOn. startWith :: (Ord k) => (forall a. IO a -> IO (Async a)) -> Rapid k -> k -> IO () -> IO () -- | Delete the thread with the given name. -- -- When an update occurs and the thread is currently running, it is -- cancelled. stop :: (Ord k) => Rapid k -> k -> x -> IO () -- | Get the value of the mutable variable with the given name. If it does -- not exist, it is created and initialised with the value returned by -- the given action. -- -- Mutable variables should only be used with values that can be -- garbage-collected, for example communication primitives like -- MVar and TVar, but also pure run-time information that -- is expensive to generate, for example the parsed contents of a file. createRef :: (Ord k, Typeable a) => Rapid k -> k -> IO a -> IO a -- | Delete the mutable variable with the given name, if it exists. deleteRef :: (Ord k) => Rapid k -> k -> IO () -- | Overwrite the mutable variable with the given name with the value -- returned by the given action. If the mutable variable does not exist, -- it is created. -- -- This function may be used to change the value type of a mutable -- variable. writeRef :: (Ord k, Typeable a) => Rapid k -> k -> IO a -> IO a