haxr 3000.10.3.1 → 3000.10.4
raw patch · 4 files changed
+36/−26 lines, 4 filesdep ~basedep ~blaze-builderdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, blaze-builder, template-haskell, time
API changes (from Hackage documentation)
- Network.XmlRpc.Internals: type Err m a = ErrorT String m a
+ Network.XmlRpc.Internals: type Err m a = ExceptT String m a
Files
- CHANGES +6/−0
- Network/XmlRpc/Internals.hs +9/−5
- Network/XmlRpc/Server.hs +18/−18
- haxr.cabal +3/−3
CHANGES view
@@ -1,3 +1,9 @@+* 3000.10.4 (22 February 2015)++ - Build on GHC 7.10+ - allow HaXml 1.25+ - allow blaze-builder-0.4+ * 3000.10.3.1 (5 September 2014) - Update .cabal file to deal with network-uri split.
Network/XmlRpc/Internals.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Network.XmlRpc.Internals@@ -38,7 +39,7 @@ import Control.Exception import Control.Monad-import Control.Monad.Error+import Control.Monad.Except import Data.Char import Data.List import Data.Maybe@@ -48,11 +49,14 @@ import Data.Time.Format import Data.Time.LocalTime import Numeric (showFFloat)-import Prelude hiding (showString, catch)+import Prelude hiding (showString) import System.IO.Unsafe (unsafePerformIO)-import System.Locale import System.Time (CalendarTime(..)) +#if ! MIN_VERSION_time(1,5,0)+import System.Locale (defaultTimeLocale)+#endif+ import qualified Data.ByteString.Char8 as BS (ByteString, pack, unpack) import qualified Data.ByteString.Lazy.Char8 as BSL (ByteString, pack) import qualified Network.XmlRpc.Base64 as Base64@@ -101,7 +105,7 @@ -- Error monad stuff -- -type Err m a = ErrorT String m a+type Err m a = ExceptT String m a -- | Evaluate the argument and catch error call exceptions errorToErr :: (Show e, MonadError e m) => a -> Err m a@@ -116,7 +120,7 @@ -- | Handle errors from the error monad. handleError :: Monad m => (String -> m a) -> Err m a -> m a handleError h m = do- Right x <- runErrorT (catchError m (lift . h))+ Right x <- runExceptT (catchError m (lift . h)) return x errorRead :: (Monad m, Read a) =>
Network/XmlRpc/Server.hs view
@@ -3,7 +3,7 @@ -- Module : Network.XmlRpc.Server -- Copyright : (c) Bjorn Bringert 2003 -- License : BSD-style--- +-- -- Maintainer : bjorn@bringert.net -- Stability : experimental -- Portability : non-portable (requires extensions and non-portable libraries)@@ -13,7 +13,7 @@ -- -- A simple CGI-based XML-RPC server application: ----- > import Network.XmlRpc.Server +-- > import Network.XmlRpc.Server -- > -- > add :: Int -> Int -> IO Int -- > add x y = return (x + y)@@ -21,23 +21,23 @@ -- > main = cgiXmlRpcServer [("examples.add", fun add)] ----------------------------------------------------------------------------- -module Network.XmlRpc.Server +module Network.XmlRpc.Server ( XmlRpcMethod, ServerResult, fun, handleCall, methods, cgiXmlRpcServer, ) where -import Network.XmlRpc.Internals+import Network.XmlRpc.Internals -import Data.ByteString.Lazy.Char8 (ByteString)+import qualified Codec.Binary.UTF8.String as U+import Control.Exception+import Control.Monad.Except+import Data.ByteString.Lazy.Char8 (ByteString) import qualified Data.ByteString.Lazy.Char8 as B-import Data.Maybe-import Control.Monad.Error-import Control.Exception-import qualified Codec.Binary.UTF8.String as U-import System.IO+import System.IO +serverName :: String serverName = "Haskell XmlRpcServer/0.1" --@@ -62,8 +62,8 @@ -- Converting Haskell functions to XML-RPC methods -- --- | Turns any function --- @(XmlRpcType t1, ..., XmlRpcType tn, XmlRpcType r) => +-- | Turns any function+-- @(XmlRpcType t1, ..., XmlRpcType tn, XmlRpcType r) => -- t1 -> ... -> tn -> IO r@ -- into an 'XmlRpcMethod' fun :: XmlRpcFun a => a -> XmlRpcMethod@@ -109,7 +109,7 @@ -- | An XmlRpcMethod that looks up the method name in a table -- and uses that method to handle the call. methods :: [(String,XmlRpcMethod)] -> MethodCall -> ServerResult-methods t c@(MethodCall name _) = +methods t c@(MethodCall name _) = do (method,_) <- maybeToM ("Unknown method: " ++ name) (lookup name t) method c@@ -126,8 +126,8 @@ -- addIntrospection :: [(String,XmlRpcMethod)] -> [(String,XmlRpcMethod)]-addIntrospection t = t' - where t' = ("system.listMethods", fun (listMethods t')) : +addIntrospection t = t'+ where t' = ("system.listMethods", fun (listMethods t')) : ("system.methodSignature", fun (methodSignature t')) : ("system.methodHelp", fun (methodHelp t')) : t @@ -135,7 +135,7 @@ listMethods t = return (fst (unzip t)) methodSignature :: [(String,XmlRpcMethod)] -> String -> IO [[String]]-methodSignature t name = +methodSignature t name = do (_,(as,r)) <- maybeToM ("Unknown method: " ++ name) (lookup name t) return [map show (r:as)]@@ -148,7 +148,7 @@ -- FIXME: implement help :: XmlRpcMethod -> String-help m = ""+help _ = "" --@@ -160,7 +160,7 @@ -- followed by the response to standard output. Supports -- introspection. cgiXmlRpcServer :: [(String,XmlRpcMethod)] -> IO ()-cgiXmlRpcServer ms = +cgiXmlRpcServer ms = do hSetBinaryMode stdin True hSetBinaryMode stdout True
haxr.cabal view
@@ -1,5 +1,5 @@ Name: haxr-Version: 3000.10.3.1+Version: 3000.10.4 Cabal-version: >=1.10 Build-type: Simple Copyright: Bjorn Bringert, 2003-2006@@ -35,7 +35,7 @@ Build-depends: base < 5, mtl, network < 2.7,- HaXml >= 1.22 && < 1.25,+ HaXml >= 1.22 && < 1.26, HTTP >= 4000, bytestring, base64-bytestring,@@ -45,7 +45,7 @@ array, utf8-string, template-haskell,- blaze-builder >= 0.2 && < 0.4+ blaze-builder >= 0.2 && < 0.5 if flag(network-uri) build-depends: network-uri >= 2.6, network >= 2.6