Safe Haskell | None |
---|
- data PluginHandle
- data PluginConf = PluginConf {
- pcGHCArgs :: [String]
- pcWhenCompiling :: FilePath -> IO ()
- pcWhenCompiled :: FilePath -> [String] -> IO ()
- pcWhenReloaded :: FilePath -> String -> [String] -> IO ()
- pcWhenWatched :: FilePath -> IO ()
- pcWhenChanged :: FilePath -> IO ()
- initPlugins :: IO PluginHandle
- initPluginsWithConf :: PluginConf -> IO PluginHandle
- defaultPluginConf :: PluginConf
- withServerPart :: Name -> ExpQ
- withServerPart_ :: (MonadIO m, ServerMonad m, FilterMonad Response m, WebMonad Response m) => Name -> a -> PluginHandle -> ([String] -> a -> m b) -> m b
Documentation
data PluginHandle
A handle holding the reloader state.
data PluginConf
Configuration options for recompiling plugins. So far we store here event callbacks and ghc arguments.
PluginConf | |
|
initPlugins :: IO PluginHandle
Initializes the plugin system and return a PluginHandle
using the default plugin configuration defaultPluginConf
.
initPluginsWithConf :: PluginConf -> IO PluginHandle
Initializes the plugin system and return a PluginHandle
.
defaultPluginConf :: PluginConf
Contains no arguments for GHC, and noop callbacks.
withServerPart :: Name -> ExpQSource
dynamically load the specified symbol pass it as an argument to the supplied server monad function.
This is a wrapper aronud withServerPart_
which ensures the first
and second argument stay in-sync.
Usage:
$(withServerPart 'symbol) pluginHandle id $ \errors a -> ...
:: (MonadIO m, ServerMonad m, FilterMonad Response m, WebMonad Response m) | |
=> Name | name of the symbol to dynamically load |
-> a | the symbol (must be the function refered to by the |
-> PluginHandle | Handle to the function reloader |
-> ([String] -> a -> m b) | function which uses the loaded result, and gets a list of compilation errors if any |
-> m b |
dynamically load the specified symbol pass it as an argument to the supplied server monad function.
If something fails, this function will return '500 Internal Server Error' and a list of the errors encountered.
see also: withServerPart