summaryrefslogtreecommitdiff
path: root/src/Remote/KRPC/Method.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Remote/KRPC/Method.hs')
-rw-r--r--src/Remote/KRPC/Method.hs30
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
24import Control.Applicative 21import Control.Applicative
@@ -69,30 +66,3 @@ idM = method "id" ["x"] ["y"]
69method :: MethodName -> [ParamName] -> [ValName] -> Method param result 66method :: MethodName -> [ParamName] -> [ValName] -> Method param result
70method = Method 67method = Method
71{-# INLINE method #-} 68{-# INLINE method #-}
72
73
74
75class Extractable a where
76 injector :: a -> [BEncode]
77 extractor :: [BEncode] -> Result a
78
79instance (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{-
89instance 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