    module Network.XmlRpc.Introspect where

    import           Network.XmlRpc.Client
    import           Network.XmlRpc.Internals

    type Signature = ([Type],Type)
    type Help = String
    type MethodInfo = (String,[Signature],Help)

    -- Primitive introspection functions

    listMethods :: String -> IO [String]
    listMethods :: String -> IO [String]
    listMethods String
    url = String -> String -> IO [String]
    forall a. Remote a => String -> String -> a
    remote String
    url String
    "system.listMethods"

    methodSignature :: String -> String -> IO [[String]]
    methodSignature :: String -> String -> IO [[String]]
    methodSignature String
    url = String -> String -> String -> IO [[String]]
    forall a. Remote a => String -> String -> a
    remote String
    url String
    "system.methodSignature"

    methodHelp :: String -> String -> IO String
    methodHelp :: String -> String -> IO String
    methodHelp String
    url = String -> String -> String -> IO String
    forall a. Remote a => String -> String -> a
    remote String
    url String
    "system.methodHelp"

    signatures :: String -> String -> IO [Signature]
    signatures :: String -> String -> IO [Signature]
    signatures String
    url String
    name = do
                          sigs <- String -> String -> IO [[String]]
    methodSignature String
    url String
    name
                          return [ (map read as,read r) | (r:as) <- sigs ]

    methodInfo :: String -> String -> IO MethodInfo
    methodInfo :: String -> String -> IO MethodInfo
    methodInfo String
    url String
    name = do
                          sigs <- String -> String -> IO [Signature]
    signatures String
    url String
    name
                          help <- methodHelp url name
                          return (name, sigs, help)