diff options
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 | ||