-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | dynamic plugin system for web applications -- -- dynamic plugin system for web applications @package web-plugins @version 0.1.2 module Web.Plugins.Core -- | When indicates when a clean up action should be run data When -- | always run this action when destroyPlugins is called Always :: When -- | only run this action if destroyPlugins is called with a failure -- present OnFailure :: When -- | only run this action when destroyPlugins is called with a -- normal shutdown OnNormal :: When data Cleanup Cleanup :: When -> (IO ()) -> Cleanup type PluginName = Text data PluginsState theme n hook config st PluginsState :: Map PluginName (Plugins theme n hook config st -> [Text] -> n) -> [Cleanup] -> Map PluginName Dynamic -> Maybe theme -> [hook] -> config -> st -> PluginsState theme n hook config st pluginsHandler :: PluginsState theme n hook config st -> Map PluginName (Plugins theme n hook config st -> [Text] -> n) pluginsOnShutdown :: PluginsState theme n hook config st -> [Cleanup] pluginsRouteFn :: PluginsState theme n hook config st -> Map PluginName Dynamic pluginsTheme :: PluginsState theme n hook config st -> Maybe theme pluginsPostHooks :: PluginsState theme n hook config st -> [hook] pluginsConfig :: PluginsState theme n hook config st -> config pluginsState :: PluginsState theme n hook config st -> st -- | we don't really want to give the Plugin unrestricted access to modify -- the PluginsState TVar. So we will use a newtype? newtype Plugins theme m hook config st Plugins :: TVar (PluginsState theme m hook config st) -> Plugins theme m hook config st ptv :: Plugins theme m hook config st -> TVar (PluginsState theme m hook config st) -- | initialize the plugins system initPlugins :: config -> st -> IO (Plugins theme n hook config st) -- | shutdown the plugins system destroyPlugins :: When -> Plugins theme m hook config st -> IO () -- | a bracketed combination of initPlugins and -- destroyPlugins. Takes care of passing the correct termination -- condition. withPlugins :: config -> st -> (Plugins theme m hook config st -> IO a) -> IO a -- | get the current st value from Plugins getPluginsSt :: MonadIO m => Plugins theme n hook config st -> m st -- | put the current st value from Plugins putPluginsSt :: MonadIO m => Plugins theme n hook config st -> st -> m () -- | modify the current st value from Plugins modifyPluginsSt :: MonadIO m => Plugins theme n hook config st -> (st -> st) -> m () -- | add a new route handler addHandler :: MonadIO m => Plugins theme n hook config st -> Text -> (Plugins theme n hook config st -> [Text] -> n) -> m () -- | add a new cleanup action to the top of the stack 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 -- | NOTE: it is possible to set the URL type incorrectly here and not get -- a type error. How can we fix that ? data Plugin url theme n hook config st Plugin :: PluginName -> (Plugins theme n hook config st -> IO (Maybe Text)) -> [Text] -> (url -> Text) -> hook -> Plugin url theme n hook config st pluginName :: Plugin url theme n hook config st -> PluginName pluginInit :: Plugin url theme n hook config st -> Plugins theme n hook config st -> IO (Maybe Text) -- | plugins which much be initialized before this one can be pluginDepends :: Plugin url theme n hook config st -> [Text] pluginToPathInfo :: Plugin url theme n hook config st -> url -> Text pluginPostHook :: Plugin url theme n hook config st -> 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) instance Eq When instance Ord When instance Show When