Safe Haskell | None |
---|---|
Language | Haskell2010 |
Support functions to call common live coding functionalities like launching and reloading
from a ghci
or cabal repl
session.
You typically don't need to import this module in your code,
but you should load it in your interactive session,
ideally by copying the file `essence-of-live-coding/.ghci` to your project,
adjusting it to your needs and launching cabal repl
.
Synopsis
- proxyFromLiveProgram :: LiveProgram m -> Proxy m
- data NoStore = NoStore
- possiblyLaunchedProgram :: Launchable m => Proxy m -> IO (Either SomeException (LaunchedProgram m))
- sync :: Launchable m => LiveProgram m -> IO ()
- launchAndSave :: Launchable m => LiveProgram m -> IO ()
- save :: Launchable m => LaunchedProgram m -> IO ()
- stopStored :: Launchable m => Proxy m -> IO ()
- liveinit :: Monad m => p -> m String
- livestep :: Monad m => p -> m [Char]
- livelaunch :: Monad m => p -> m [Char]
- livereload :: Monad m => p -> m String
- livestop :: Monad m => p -> m [Char]
Documentation
proxyFromLiveProgram :: LiveProgram m -> Proxy m Source #
An exception type marking the absence of a foreign store of the correct type.
Instances
Show NoStore Source # | |
Exception NoStore Source # | |
Defined in LiveCoding.GHCi toException :: NoStore -> SomeException # fromException :: SomeException -> Maybe NoStore # displayException :: NoStore -> String # |
Retrieving launched programs from the foreign store
possiblyLaunchedProgram :: Launchable m => Proxy m -> IO (Either SomeException (LaunchedProgram m)) Source #
Try to retrieve a LiveProgram
of a given type from the Store
,
handling all IO
exceptions.
Returns 'Right Nothing' if the store didn't exist.
sync :: Launchable m => LiveProgram m -> IO () Source #
Try to load a LiveProgram
of a given type from the Store
.
If the store doesn't contain a program, it is (re)started.
launchAndSave :: Launchable m => LiveProgram m -> IO () Source #
Launch a LiveProgram
and save it in the Store
.
save :: Launchable m => LaunchedProgram m -> IO () Source #
Save a LiveProgram
to the store.
stopStored :: Launchable m => Proxy m -> IO () Source #
Try to retrieve a LaunchedProgram
from the Store
,
and if successful, stop it.
GHCi commands
Debugging
liveinit :: Monad m => p -> m String Source #
Initialise a launched program in the store, but don't start it.
livestep :: Monad m => p -> m [Char] Source #
Run one program step, assuming you have a launched program in a variable launchedProgram
.
Running
livelaunch :: Monad m => p -> m [Char] Source #
Launch or restart a program and save its reference in the store.
livereload :: Monad m => p -> m String Source #
Reload the code and do hot code swap and migration.