diff options
Diffstat (limited to 'src/Network/KRPC')
-rw-r--r-- | src/Network/KRPC/Method.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Network/KRPC/Method.hs b/src/Network/KRPC/Method.hs index 54aa8ef0..f2461a1b 100644 --- a/src/Network/KRPC/Method.hs +++ b/src/Network/KRPC/Method.hs | |||
@@ -2,14 +2,17 @@ | |||
2 | {-# LANGUAGE MultiParamTypeClasses #-} | 2 | {-# LANGUAGE MultiParamTypeClasses #-} |
3 | {-# LANGUAGE FunctionalDependencies #-} | 3 | {-# LANGUAGE FunctionalDependencies #-} |
4 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | 4 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
5 | {-# LANGUAGE ScopedTypeVariables #-} | 5 | {-# LANGUAGE ScopedTypeVariables #-} |
6 | {-# LANGUAGE DefaultSignatures #-} | ||
6 | module Network.KRPC.Method | 7 | module Network.KRPC.Method |
7 | ( Method (..) | 8 | ( Method (..) |
8 | , KRPC (..) | 9 | , KRPC (..) |
9 | ) where | 10 | ) where |
10 | 11 | ||
11 | import Data.BEncode (BEncode) | 12 | import Data.BEncode (BEncode) |
13 | import Data.Char | ||
12 | import Data.Monoid | 14 | import Data.Monoid |
15 | import Data.List as L | ||
13 | import Data.String | 16 | import Data.String |
14 | import Data.Typeable | 17 | import Data.Typeable |
15 | import Network.KRPC.Message | 18 | import Network.KRPC.Message |
@@ -59,3 +62,8 @@ showsMethod (Method name) = | |||
59 | -- @ | 62 | -- @ |
60 | class (BEncode req, BEncode resp) => KRPC req resp | req -> resp where | 63 | class (BEncode req, BEncode resp) => KRPC req resp | req -> resp where |
61 | method :: Method req resp | 64 | method :: Method req resp |
65 | |||
66 | default method :: Typeable req => Method req resp | ||
67 | method = Method $ fromString $ L.map toLower $ show $ typeOf hole | ||
68 | where | ||
69 | hole = error "krpc.method: impossible" :: req | ||