essence-of-live-coding-0.2.1: General purpose live coding framework

Safe HaskellNone
LanguageHaskell2010

LiveCoding.RuntimeIO.Launch

Synopsis

Documentation

class Monad m => Launchable m where Source #

Monads in which live programs can be launched in IO, for example when you have special effects that have to be handled on every reload.

The only thing necessary is to transform the LiveProgram into one in the IO monad, and the rest is taken care of in the framework.

data LaunchedProgram (m :: * -> *) Source #

launch :: Launchable m => LiveProgram m -> IO (LaunchedProgram m) Source #

Launch a LiveProgram in a separate thread.

The MVar can be used to update the program while automatically migrating it. The ThreadId represents the thread where the program runs in. You're advised not to kill it directly, but to run stop instead.

update :: Launchable m => LaunchedProgram m -> LiveProgram m -> IO () Source #

Migrate (using hotCodeSwap) the LiveProgram to a new version.

stop :: Launchable m => LaunchedProgram m -> IO () Source #

Stops a thread where a LiveProgram is being executed.

Before the thread is killed, an empty program (in the monad m) is first inserted and stepped. This can be used to call cleanup actions encoded in the monad.

launchWithDebugger :: (Monad m, Launchable m) => LiveProgram m -> Debugger m -> IO (LaunchedProgram m) Source #

Launch a LiveProgram, but first attach a debugger to it.

background :: MVar (LiveProgram IO) -> IO () Source #

This is the background task executed by launch.

stepProgram :: Monad m => LiveProgram m -> m (LiveProgram m) Source #

Advance a LiveProgram by a single step.

stepLaunchedProgram :: (Monad m, Launchable m) => LaunchedProgram m -> IO () Source #

Advance a launched LiveProgram by a single step and store the result.