Safe Haskell | None |
---|
- data When
- isWhen :: When -> When -> Bool
- data Cleanup = Cleanup When (IO ())
- type PluginName = Text
- data PluginsState theme n hook config st = PluginsState {
- pluginsHandler :: Map PluginName (Plugins theme n hook config st -> [Text] -> n)
- pluginsOnShutdown :: [Cleanup]
- pluginsRouteFn :: Map PluginName Dynamic
- pluginsTheme :: Maybe theme
- pluginsPostHooks :: [hook]
- pluginsConfig :: config
- pluginsState :: st
- newtype Plugins theme m hook config st = Plugins {
- ptv :: TVar (PluginsState theme m hook config st)
- initPlugins :: config -> st -> IO (Plugins theme n hook config st)
- destroyPlugins :: When -> Plugins theme m hook config st -> IO ()
- withPlugins :: config -> st -> (Plugins theme m hook config st -> IO a) -> IO a
- getPluginsSt :: MonadIO m => Plugins theme n hook config st -> m st
- putPluginsSt :: MonadIO m => Plugins theme n hook config st -> st -> m ()
- modifyPluginsSt :: MonadIO m => Plugins theme n hook config st -> (st -> st) -> m ()
- addHandler :: MonadIO m => Plugins theme n hook config st -> Text -> (Plugins theme n hook config st -> [Text] -> n) -> m ()
- addCleanup :: MonadIO m => Plugins theme n hook config st -> When -> IO () -> m ()
- addPostHook :: MonadIO m => Plugins theme n hook config st -> hook -> m ()
- getPostHooks :: MonadIO m => Plugins theme n hook config st -> m [hook]
- addPluginRouteFn :: (MonadIO m, Typeable url) => Plugins theme n hook config st -> Text -> (url -> [(Text, Maybe Text)] -> Text) -> m ()
- getPluginRouteFn :: (MonadIO m, Typeable url) => Plugins theme n hook config st -> Text -> m (Maybe (url -> [(Text, Maybe Text)] -> Text))
- setTheme :: MonadIO m => Plugins theme n hook config st -> Maybe theme -> m ()
- getTheme :: MonadIO m => Plugins theme n hook config st -> m (Maybe theme)
- getConfig :: MonadIO m => Plugins theme n hook config st -> m config
- data Plugin url theme n hook config st = Plugin {
- pluginName :: PluginName
- pluginInit :: Plugins theme n hook config st -> IO (Maybe Text)
- pluginDepends :: [Text]
- pluginToPathInfo :: url -> Text
- pluginPostHook :: hook
- initPlugin :: Typeable url => Plugins theme n hook config st -> Text -> Plugin url theme n hook config st -> IO (Maybe Text)
- serve :: Plugins theme n hook config st -> Text -> [Text] -> IO (Either String n)
Documentation
type PluginName = TextSource
data PluginsState theme n hook config st Source
PluginsState | |
|
newtype Plugins theme m hook config st Source
we don't really want to give the Plugin unrestricted access to modify the PluginsState TVar. So we will use a newtype?
Plugins | |
|
initPlugins :: config -> st -> IO (Plugins theme n hook config st)Source
destroyPlugins :: When -> Plugins theme m hook config st -> IO ()Source
withPlugins :: config -> st -> (Plugins theme m hook config st -> IO a) -> IO aSource
a bracketed combination of initPlugins
and destroyPlugins
. Takes care of passing the correct termination condition.
PluginsSt
getPluginsSt :: MonadIO m => Plugins theme n hook config st -> m stSource
putPluginsSt :: MonadIO m => Plugins theme n hook config st -> st -> m ()Source
modifyPluginsSt :: MonadIO m => Plugins theme n hook config st -> (st -> st) -> m ()Source
addHandler :: MonadIO m => Plugins theme n hook config st -> Text -> (Plugins theme n hook config st -> [Text] -> n) -> m ()Source
addCleanup :: MonadIO m => Plugins theme n hook config st -> When -> IO () -> m ()Source
add a new cleanup action to the top of the stack
addPostHook :: MonadIO m => Plugins theme n hook config st -> hook -> m ()Source
getPostHooks :: MonadIO m => Plugins theme n hook config st -> m [hook]Source
addPluginRouteFn :: (MonadIO m, Typeable url) => Plugins theme n hook config st -> Text -> (url -> [(Text, Maybe Text)] -> Text) -> m ()Source
getPluginRouteFn :: (MonadIO m, Typeable url) => Plugins theme n hook config st -> Text -> m (Maybe (url -> [(Text, Maybe Text)] -> Text))Source
data Plugin url theme n hook config st Source
NOTE: it is possible to set the URL type incorrectly here and not get a type error. How can we fix that ?
Plugin | |
|