summaryrefslogtreecommitdiff
path: root/src/Network/KRPC
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/KRPC')
-rw-r--r--src/Network/KRPC/Scheme.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Network/KRPC/Scheme.hs b/src/Network/KRPC/Scheme.hs
index 9d8a1876..244f035d 100644
--- a/src/Network/KRPC/Scheme.hs
+++ b/src/Network/KRPC/Scheme.hs
@@ -23,7 +23,6 @@ module Network.KRPC.Scheme
23import Control.Applicative 23import Control.Applicative
24import Data.BEncode.BDict as BS 24import Data.BEncode.BDict as BS
25import Data.BEncode.Types as BS 25import Data.BEncode.Types as BS
26import Data.Set as S
27 26
28import Network.KRPC.Protocol 27import Network.KRPC.Protocol
29import Network.KRPC 28import Network.KRPC
@@ -51,7 +50,7 @@ instance KMessage KError ErrorCode where
51 50
52data KQueryScheme = KQueryScheme { 51data KQueryScheme = KQueryScheme {
53 qscMethod :: MethodName 52 qscMethod :: MethodName
54 , qscParams :: Set ParamName 53 , qscParams :: [ParamName]
55 } deriving (Show, Read, Eq, Ord) 54 } deriving (Show, Read, Eq, Ord)
56 55
57bdictKeys :: BDict -> [BKey] 56bdictKeys :: BDict -> [BKey]
@@ -61,24 +60,23 @@ bdictKeys Nil = []
61instance KMessage KQuery KQueryScheme where 60instance KMessage KQuery KQueryScheme where
62 scheme q = KQueryScheme 61 scheme q = KQueryScheme
63 { qscMethod = queryMethod q 62 { qscMethod = queryMethod q
64 , qscParams = S.fromAscList $ bdictKeys $ queryArgs q 63 , qscParams = bdictKeys $ queryArgs q
65 } 64 }
66 {-# INLINE scheme #-} 65 {-# INLINE scheme #-}
67 66
68methodQueryScheme :: Method a b -> KQueryScheme 67methodQueryScheme :: Method a b -> KQueryScheme
69methodQueryScheme = KQueryScheme <$> methodName 68methodQueryScheme = KQueryScheme <$> methodName <*> methodParams
70 <*> S.fromList . methodParams
71{-# INLINE methodQueryScheme #-} 69{-# INLINE methodQueryScheme #-}
72 70
73newtype KResponseScheme = KResponseScheme 71newtype KResponseScheme = KResponseScheme
74 { rscVals :: Set ValName 72 { rscVals :: [ValName]
75 } deriving (Show, Read, Eq, Ord) 73 } deriving (Show, Read, Eq, Ord)
76 74
77instance KMessage KResponse KResponseScheme where 75instance KMessage KResponse KResponseScheme where
78 {-# SPECIALIZE instance KMessage KResponse KResponseScheme #-} 76 {-# SPECIALIZE instance KMessage KResponse KResponseScheme #-}
79 scheme = KResponseScheme . S.fromAscList . bdictKeys . respVals 77 scheme = KResponseScheme . bdictKeys . respVals
80 {-# INLINE scheme #-} 78 {-# INLINE scheme #-}
81 79
82methodRespScheme :: Method a b -> KResponseScheme 80methodRespScheme :: Method a b -> KResponseScheme
83methodRespScheme = KResponseScheme . S.fromList . methodVals 81methodRespScheme = KResponseScheme . methodVals
84{-# INLINE methodRespScheme #-} 82{-# INLINE methodRespScheme #-}