Copyright | (c) Bjorn Bringert 2003 |
---|---|
License | BSD-style |
Maintainer | bjorn@bringert.net |
Stability | experimental |
Portability | non-portable (requires extensions and non-portable libraries) |
Safe Haskell | None |
Language | Haskell2010 |
This module contains the core functionality of the XML-RPC library. Most applications should not need to use this module. Client applications should use Network.XmlRpc.Client and server applications should use Network.XmlRpc.Server.
The XML-RPC specifcation is available at http://www.xmlrpc.com/spec.
Synopsis
- data MethodCall = MethodCall String [Value]
- data MethodResponse
- data Value
- data Type
- class XmlRpcType a where
- parseResponse :: (Show e, MonadError e m, MonadFail m) => String -> Err m MethodResponse
- parseCall :: (Show e, MonadError e m, MonadFail m) => String -> Err m MethodCall
- getField :: (MonadFail m, XmlRpcType a) => String -> [(String, Value)] -> Err m a
- getFieldMaybe :: (MonadFail m, XmlRpcType a) => String -> [(String, Value)] -> Err m (Maybe a)
- renderCall :: MethodCall -> ByteString
- renderResponse :: MethodResponse -> ByteString
- toXRValue :: Value -> Value
- fromXRValue :: MonadFail m => Value -> Err m Value
- toXRMethodCall :: MethodCall -> MethodCall
- fromXRMethodCall :: MonadFail m => MethodCall -> Err m MethodCall
- toXRMethodResponse :: MethodResponse -> MethodResponse
- fromXRMethodResponse :: MonadFail m => MethodResponse -> Err m MethodResponse
- toXRParams :: [Value] -> Params
- fromXRParams :: MonadFail m => Params -> Err m [Value]
- toXRMember :: (String, Value) -> Member
- fromXRMember :: MonadFail m => Member -> Err m (String, Value)
- type Err m a = ExceptT String m a
- maybeToM :: MonadFail m => String -> Maybe a -> m a
- handleError :: MonadFail m => (String -> m a) -> Err m a -> m a
- ioErrorToErr :: IO a -> Err IO a
Method calls and repsonses
data MethodCall Source #
An XML-RPC method call. Consists of a method name and a list of parameters.
Instances
Eq MethodCall Source # | |
Defined in Network.XmlRpc.Internals (==) :: MethodCall -> MethodCall -> Bool # (/=) :: MethodCall -> MethodCall -> Bool # | |
Show MethodCall Source # | |
Defined in Network.XmlRpc.Internals showsPrec :: Int -> MethodCall -> ShowS # show :: MethodCall -> String # showList :: [MethodCall] -> ShowS # |
data MethodResponse Source #
An XML-RPC response.
Instances
Eq MethodResponse Source # | |
Defined in Network.XmlRpc.Internals (==) :: MethodResponse -> MethodResponse -> Bool # (/=) :: MethodResponse -> MethodResponse -> Bool # | |
Show MethodResponse Source # | |
Defined in Network.XmlRpc.Internals showsPrec :: Int -> MethodResponse -> ShowS # show :: MethodResponse -> String # showList :: [MethodResponse] -> ShowS # |
XML-RPC types
An XML-RPC value.
ValueInt Int | int, i4, or i8 |
ValueBool Bool | bool |
ValueString String | string |
ValueUnwrapped String | no inner element |
ValueDouble Double | double |
ValueDateTime LocalTime | dateTime.iso8601 |
ValueBase64 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 |
An XML-RPC value. Use for error messages and introspection.
class XmlRpcType a where Source #
A class for mapping Haskell types to XML-RPC types.
toValue :: a -> Value Source #
Convert from this type to a Value
fromValue :: MonadFail m => Value -> Err m a Source #
Convert from a Value
to this type. May fail if
if there is a type error.
Instances
XmlRpcType Bool Source # | |
XmlRpcType Double Source # | |
XmlRpcType Int Source # | |
XmlRpcType () Source # | |
XmlRpcType ByteString Source # | |
Defined in Network.XmlRpc.Internals | |
XmlRpcType Text Source # | |
XmlRpcType String Source # | |
XmlRpcType CalendarTime Source # | |
Defined in Network.XmlRpc.Internals | |
XmlRpcType LocalTime Source # | |
XmlRpcType Value Source # | Exists to allow explicit type conversions. |
XmlRpcType a => XmlRpcType [(String, a)] Source # | |
XmlRpcType a => XmlRpcType [a] Source # | |
(XmlRpcType a, XmlRpcType b) => XmlRpcType (a, b) Source # | |
(XmlRpcType a, XmlRpcType b, XmlRpcType c) => XmlRpcType (a, b, c) Source # | |
(XmlRpcType a, XmlRpcType b, XmlRpcType c, XmlRpcType d) => XmlRpcType (a, b, c, d) Source # | |
(XmlRpcType a, XmlRpcType b, XmlRpcType c, XmlRpcType d, XmlRpcType e) => XmlRpcType (a, b, c, d, e) Source # | |
Converting from XML
parseResponse :: (Show e, MonadError e m, MonadFail m) => String -> Err m MethodResponse Source #
Parses a method response from XML.
parseCall :: (Show e, MonadError e m, MonadFail m) => String -> Err m MethodCall Source #
Parses a method call from XML.
Get a field value from a (possibly heterogeneous) struct.
Get a field value from a (possibly heterogeneous) struct.
Converting to XML
renderCall :: MethodCall -> ByteString Source #
Makes an XML-representation of a method call. FIXME: pretty prints ugly XML
renderResponse :: MethodResponse -> ByteString Source #
Makes an XML-representation of a method response. FIXME: pretty prints ugly XML
Converting to and from DTD types
fromXRMethodCall :: MonadFail m => MethodCall -> Err m MethodCall Source #
fromXRMethodResponse :: MonadFail m => MethodResponse -> Err m MethodResponse Source #
toXRParams :: [Value] -> Params Source #
Error monad
:: MonadFail m | |
=> String | Error message to fail with for |
-> Maybe a | The |
-> m a | The resulting value in the monad. |
Convert a HType
value to a value in any monad