happstack-plugins 6.2.1 → 6.3.1
raw patch · 3 files changed
+18/−14 lines, 3 filesdep +th-liftdep ~plugins-auto
Dependencies added: th-lift
Dependency ranges changed: plugins-auto
Files
- Happstack/Server/Plugins/Dynamic.hs +4/−6
- Happstack/Server/Plugins/Static.hs +9/−4
- happstack-plugins.cabal +5/−4
Happstack/Server/Plugins/Dynamic.hs view
@@ -10,11 +10,10 @@ ) where import Control.Monad.Trans (MonadIO)-import Language.Haskell.TH (ExpQ, appE, varE)-import Language.Haskell.TH.Syntax (Name)+import Language.Haskell.TH (ExpQ, Name, appE, varE)+import Language.Haskell.TH.Lift (lift) import System.Plugins.Auto ( initPlugins,initPluginsWithConf,PluginHandle,withMonadIO_ , PluginConf(..), defaultPluginConf)-import System.Plugins.Auto.LiftName (liftName) import Happstack.Server (ServerMonad, FilterMonad, WebMonad, Response, internalServerError, escape, toResponse) -- | dynamically load the specified symbol pass it as an argument to@@ -28,7 +27,7 @@ -- > $(withServerPart 'symbol) pluginHandle id $ \errors a -> ... -- withServerPart :: Name -> ExpQ-withServerPart name = appE (appE [| withServerPart_ |] (liftName name)) (varE name)+withServerPart name = appE (appE [| withServerPart_ |] (lift name)) (varE name) -- | dynamically load the specified symbol pass it as an argument to -- the supplied server monad function.@@ -41,10 +40,9 @@ Name -- ^ name of the symbol to dynamically load -> a -- ^ the symbol (must be the function refered to by the 'Name' argument) -> PluginHandle -- ^ Handle to the function reloader- -> (PluginConf -> PluginConf) -- ^ Modifications to the plugin configuration. -> ([String] -> a -> m b) -- ^ function which uses the loaded result, and gets a list of compilation errors if any -> m b -withServerPart_ name fun ph fconf use = withMonadIO_ name fun ph fconf notLoaded use+withServerPart_ name fun ph use = withMonadIO_ name fun ph notLoaded use where notLoaded errs = escape $ internalServerError$ toResponse$ case errs of
Happstack/Server/Plugins/Static.hs view
@@ -12,7 +12,7 @@ import Control.Monad.Trans (MonadIO) import Happstack.Server (ServerMonad, FilterMonad, WebMonad, Response) import Language.Haskell.TH (ExpQ, Name, appE, varE)-import System.Plugins.Auto.LiftName+import Language.Haskell.TH.Lift (lift) -- instance Lift Name import System.Plugins.Auto (PluginConf(..),defaultPluginConf) -- | A template haskell wrapper around 'withServerPart_'.@@ -21,7 +21,7 @@ -- > $(withServerPart 'symbol) pluginHandle id $ \errors a -> ... -- withServerPart :: Name -> ExpQ-withServerPart name = appE (appE [| withServerPart_ |] (liftName name)) (varE name)+withServerPart name = appE (appE [| withServerPart_ |] (lift name)) (varE name) -- | a static version of 'Happstack.Server.Plugins.Dynamic.withServerPart_' --@@ -34,8 +34,13 @@ -- build. -- -- Use a CPP to select between the Dynamic and Static versions of this module.-withServerPart_ :: (MonadIO m, ServerMonad m, FilterMonad Response m, WebMonad Response m) => Name -> a -> PluginHandle -> (PluginConf -> PluginConf) -> ([String] -> a -> m b) -> m b-withServerPart_ _name fun _objMap _args use = use [] fun+withServerPart_ :: (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 'Name' argument)+ -> 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 +withServerPart_ _name fun _objMap use = use [] fun -- | Dummy plugin handle. In a static configuration its values are not used at all. data PluginHandle
happstack-plugins.cabal view
@@ -1,5 +1,5 @@ Name: happstack-plugins-Version: 6.2.1+Version: 6.3.1 Synopsis: The haskell application server stack + reload Description: This library provides support for automatically recompiling and reloading modules into a running server. License: BSD3@@ -28,9 +28,10 @@ Happstack.Server.Plugins.Static build-depends: base >= 3 && < 5,- plugins-auto,+ plugins-auto == 0.0.*, mtl,- happstack-server>=6,- template-haskell+ happstack-server >= 6,+ template-haskell,+ th-lift == 0.5.* ghc-options: -Wall