diff options
Diffstat (limited to 'src/Network/KRPC')
-rw-r--r-- | src/Network/KRPC/Scheme.hs | 14 |
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 | |||
23 | import Control.Applicative | 23 | import Control.Applicative |
24 | import Data.BEncode.BDict as BS | 24 | import Data.BEncode.BDict as BS |
25 | import Data.BEncode.Types as BS | 25 | import Data.BEncode.Types as BS |
26 | import Data.Set as S | ||
27 | 26 | ||
28 | import Network.KRPC.Protocol | 27 | import Network.KRPC.Protocol |
29 | import Network.KRPC | 28 | import Network.KRPC |
@@ -51,7 +50,7 @@ instance KMessage KError ErrorCode where | |||
51 | 50 | ||
52 | data KQueryScheme = KQueryScheme { | 51 | data 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 | ||
57 | bdictKeys :: BDict -> [BKey] | 56 | bdictKeys :: BDict -> [BKey] |
@@ -61,24 +60,23 @@ bdictKeys Nil = [] | |||
61 | instance KMessage KQuery KQueryScheme where | 60 | instance 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 | ||
68 | methodQueryScheme :: Method a b -> KQueryScheme | 67 | methodQueryScheme :: Method a b -> KQueryScheme |
69 | methodQueryScheme = KQueryScheme <$> methodName | 68 | methodQueryScheme = KQueryScheme <$> methodName <*> methodParams |
70 | <*> S.fromList . methodParams | ||
71 | {-# INLINE methodQueryScheme #-} | 69 | {-# INLINE methodQueryScheme #-} |
72 | 70 | ||
73 | newtype KResponseScheme = KResponseScheme | 71 | newtype KResponseScheme = KResponseScheme |
74 | { rscVals :: Set ValName | 72 | { rscVals :: [ValName] |
75 | } deriving (Show, Read, Eq, Ord) | 73 | } deriving (Show, Read, Eq, Ord) |
76 | 74 | ||
77 | instance KMessage KResponse KResponseScheme where | 75 | instance 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 | ||
82 | methodRespScheme :: Method a b -> KResponseScheme | 80 | methodRespScheme :: Method a b -> KResponseScheme |
83 | methodRespScheme = KResponseScheme . S.fromList . methodVals | 81 | methodRespScheme = KResponseScheme . methodVals |
84 | {-# INLINE methodRespScheme #-} | 82 | {-# INLINE methodRespScheme #-} |