haxr 3000.11.3.1 → 3000.11.4
raw patch · 4 files changed
+33/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.XmlRpc.DTD_XMLRPC: Nil :: () -> Nil
+ Network.XmlRpc.DTD_XMLRPC: Value_Nil :: Nil -> Value_
+ Network.XmlRpc.DTD_XMLRPC: instance GHC.Classes.Eq Network.XmlRpc.DTD_XMLRPC.Nil
+ Network.XmlRpc.DTD_XMLRPC: instance GHC.Show.Show Network.XmlRpc.DTD_XMLRPC.Nil
+ Network.XmlRpc.DTD_XMLRPC: instance Text.XML.HaXml.TypeMapping.HTypeable Network.XmlRpc.DTD_XMLRPC.Nil
+ Network.XmlRpc.DTD_XMLRPC: instance Text.XML.HaXml.XmlContent.Parser.XmlContent Network.XmlRpc.DTD_XMLRPC.Nil
+ Network.XmlRpc.DTD_XMLRPC: newtype Nil
+ Network.XmlRpc.Internals: TNil :: Type
+ Network.XmlRpc.Internals: ValueNil :: Value
+ Network.XmlRpc.Internals: instance Network.XmlRpc.Internals.XmlRpcType ()
Files
- CHANGES +4/−0
- Network/XmlRpc/DTD_XMLRPC.hs +14/−0
- Network/XmlRpc/Internals.hs +13/−0
- haxr.cabal +2/−2
CHANGES view
@@ -1,3 +1,7 @@+* 3000.11.4 (24 January 2020)++ - Add support for <nil/> corresponding to unit () in Haskell+ * 3000.11.3.1 (17 December 2019) - Updates for GHC 8.8, network-3.1
Network/XmlRpc/DTD_XMLRPC.hs view
@@ -21,6 +21,7 @@ data Member = Member Name Value deriving (Eq,Show) newtype Struct = Struct [Member] deriving (Eq,Show)+newtype Nil = Nil () deriving (Eq,Show) newtype Value = Value [Value_] deriving (Eq,Show) data Value_ = Value_Str String | Value_I4 I4@@ -33,6 +34,7 @@ | Value_Base64 Base64 | Value_Struct Struct | Value_Array Array+ | Value_Nil Nil deriving (Eq,Show) newtype Param = Param Value deriving (Eq,Show) newtype Params = Params [Param] deriving (Eq,Show)@@ -118,6 +120,16 @@ `apply` (text `onFail` return "") } `adjustErr` ("in <dateTime.iso8601>, "++) +instance HTypeable Nil where+ toHType x = Defined "nil" [] []+instance XmlContent Nil where+ toContents (Nil a) =+ [CElem (Elem (N "nil") [] []) ()]+ parseContents = do+ { e@(Elem _ [] _) <- element ["nil"]+ ; interior e $ return (Nil) `apply` (return ())+ } `adjustErr` ("in <nil/>, "++)+ instance HTypeable Base64 where toHType x = Defined "base64" [] [] instance XmlContent Base64 where@@ -203,6 +215,7 @@ toContents (Value_Base64 a) = toContents a toContents (Value_Struct a) = toContents a toContents (Value_Array a) = toContents a+ toContents (Value_Nil a) = toContents a parseContents = oneOf [ return (Value_Str) `apply` text , return (Value_I4) `apply` parseContents@@ -215,6 +228,7 @@ , return (Value_Base64) `apply` parseContents , return (Value_Struct) `apply` parseContents , return (Value_Array) `apply` parseContents+ , return (Value_Nil) `apply` parseContents ] `adjustErr` ("in <value>, "++) instance HTypeable Param where
Network/XmlRpc/Internals.hs view
@@ -170,6 +170,7 @@ | ValueBase64 BS.ByteString -- ^ base 64. NOTE that you should provide the raw data; the haxr library takes care of doing the base-64 encoding. | ValueStruct [(String,Value)] -- ^ struct | ValueArray [Value] -- ^ array+ | ValueNil -- ^ nil deriving (Eq, Show) -- for debugging -- | An XML-RPC value. Use for error messages and introspection.@@ -183,6 +184,7 @@ | TStruct | TArray | TUnknown+ | TNil deriving (Eq) instance Show Type where@@ -195,6 +197,7 @@ show TStruct = "struct" show TArray = "array" show TUnknown = "unknown"+ show TNil = "nil" instance Read Type where readsPrec _ s = case break isSpace (dropWhile isSpace s) of@@ -206,6 +209,7 @@ ("base64",r) -> [(TBase64,r)] ("struct",r) -> [(TStruct,r)] ("array",r) -> [(TArray,r)]+ ("nil",r) -> [(TNil,r)] -- | Gets the value of a struct member structGetValue :: MonadFail m => String -> Value -> Err m Value@@ -319,6 +323,13 @@ fromValue = liftM localTimeToCalendarTime . fromValue getType _ = TDateTime +instance XmlRpcType () where+ toValue = const ValueNil+ fromValue = simpleFromValue f+ where f ValueNil = Just ()+ f _ = Nothing+ getType _ = TNil+ -- FIXME: array elements may have different types instance OVERLAPPABLE_ XmlRpcType a => XmlRpcType [a] where toValue = ValueArray . map toValue@@ -402,6 +413,7 @@ toXRValue (ValueStruct xs) = XR.Value [XR.Value_Struct (XR.Struct (map toXRMember xs))] toXRValue (ValueArray xs) = XR.Value [XR.Value_Array (XR.Array (XR.Data (map toXRValue xs)))]+toXRValue ValueNil = XR.Value [XR.Value_Nil (XR.Nil ())] showInt :: Int -> String showInt = show@@ -467,6 +479,7 @@ liftM ValueStruct (mapM fromXRMember ms) f (XR.Value_Array (XR.Array (XR.Data xs))) = liftM ValueArray (mapM fromXRValue xs)+ f (XR.Value_Nil (XR.Nil x)) = return ValueNil fromXRMember :: MonadFail m => XR.Member -> Err m (String,Value)
haxr.cabal view
@@ -1,5 +1,5 @@ Name: haxr-Version: 3000.11.3.1+Version: 3000.11.4 Cabal-version: >=1.10 Build-type: Simple Copyright: Bjorn Bringert, 2003-2006@@ -34,7 +34,7 @@ Library Build-depends: base >= 4.9 && < 4.14,- base-compat >= 0.8 && < 0.11,+ base-compat >= 0.8 && < 0.12, mtl, mtl-compat, network < 3.2,