-- 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.1
module Web.Plugins.Core
data When
Always :: When
OnFailure :: When
OnNormal :: When
isWhen :: When -> When -> Bool
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)
initPlugins :: config -> st -> IO (Plugins theme n hook config st)
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
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 ()
-- | 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