diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-29 19:28:30 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-29 19:28:30 +0400 |
commit | 8e9896c5d03ba2362e5068151106f756f0a002a1 (patch) | |
tree | cfb508c8b13b3442592c5af0e1163d00aca7ff49 /src/Network/BitTorrent/Tracker | |
parent | 10b16409b44e0f11db57e52d6ddd1f95a4eb7aec (diff) |
Remove byteStringToPeerId to simplify API
Diffstat (limited to 'src/Network/BitTorrent/Tracker')
-rw-r--r-- | src/Network/BitTorrent/Tracker/Message.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Tracker/Message.hs b/src/Network/BitTorrent/Tracker/Message.hs index 046f7e57..9999d128 100644 --- a/src/Network/BitTorrent/Tracker/Message.hs +++ b/src/Network/BitTorrent/Tracker/Message.hs | |||
@@ -267,7 +267,7 @@ instance FromParam InfoHash where | |||
267 | fromParam = either (const Nothing) pure . safeConvert | 267 | fromParam = either (const Nothing) pure . safeConvert |
268 | 268 | ||
269 | instance FromParam PeerId where | 269 | instance FromParam PeerId where |
270 | fromParam = byteStringToPeerId | 270 | fromParam = either (const Nothing) pure . safeConvert |
271 | 271 | ||
272 | instance FromParam Word32 where | 272 | instance FromParam Word32 where |
273 | fromParam = readMaybe . BC.unpack | 273 | fromParam = readMaybe . BC.unpack |
@@ -282,9 +282,9 @@ instance FromParam PortNumber where | |||
282 | fromParam bs = fromIntegral <$> (fromParam bs :: Maybe Word32) | 282 | fromParam bs = fromIntegral <$> (fromParam bs :: Maybe Word32) |
283 | 283 | ||
284 | instance FromParam Event where | 284 | instance FromParam Event where |
285 | fromParam bs = case BC.uncons bs of | 285 | fromParam bs = do |
286 | Nothing -> Nothing | 286 | (x, xs) <- BC.uncons bs |
287 | Just (x, xs) -> readMaybe $ BC.unpack $ BC.cons (Char.toUpper x) xs | 287 | readMaybe $ BC.unpack $ BC.cons (Char.toUpper x) xs |
288 | 288 | ||
289 | type Result = Either ParamParseFailure | 289 | type Result = Either ParamParseFailure |
290 | 290 | ||