diff options
Diffstat (limited to 'src/Remote/KRPC/Method.hs')
-rw-r--r-- | src/Remote/KRPC/Method.hs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/Remote/KRPC/Method.hs b/src/Remote/KRPC/Method.hs index d0c8e89a..4283256b 100644 --- a/src/Remote/KRPC/Method.hs +++ b/src/Remote/KRPC/Method.hs | |||
@@ -16,9 +16,6 @@ module Remote.KRPC.Method | |||
16 | 16 | ||
17 | -- * Predefined methods | 17 | -- * Predefined methods |
18 | , idM | 18 | , idM |
19 | |||
20 | -- * Internal | ||
21 | , Extractable(..) | ||
22 | ) where | 19 | ) where |
23 | 20 | ||
24 | import Control.Applicative | 21 | import Control.Applicative |
@@ -69,30 +66,3 @@ idM = method "id" ["x"] ["y"] | |||
69 | method :: MethodName -> [ParamName] -> [ValName] -> Method param result | 66 | method :: MethodName -> [ParamName] -> [ValName] -> Method param result |
70 | method = Method | 67 | method = Method |
71 | {-# INLINE method #-} | 68 | {-# INLINE method #-} |
72 | |||
73 | |||
74 | |||
75 | class Extractable a where | ||
76 | injector :: a -> [BEncode] | ||
77 | extractor :: [BEncode] -> Result a | ||
78 | |||
79 | instance (BEncodable a, BEncodable b) => Extractable (a, b) where | ||
80 | {- SPECIALIZE instance (BEncodable a, BEncodable b) => Extractable (a, b) -} | ||
81 | injector (a, b) = [toBEncode a, toBEncode b] | ||
82 | {-# INLINE injector #-} | ||
83 | |||
84 | extractor [a, b] = (,) <$> fromBEncode a <*> fromBEncode b | ||
85 | extractor _ = decodingError "unable to match pair" | ||
86 | {-# INLINE extractor #-} | ||
87 | |||
88 | {- | ||
89 | instance BEncodable a => Extractable a where | ||
90 | {-# SPECIALIZE instance BEncodable a => Extractable a #-} | ||
91 | |||
92 | injector x = [toBEncode x] | ||
93 | {-# INLINE injector #-} | ||
94 | |||
95 | extractor [x] = fromBEncode x | ||
96 | extractor _ = decodingError "unable to match single value" | ||
97 | {-# INLINE extractor #-} | ||
98 | -} \ No newline at end of file | ||