summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Data/BEncode.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Data/BEncode.hs b/src/Data/BEncode.hs
index 4a80e47..80f0108 100644
--- a/src/Data/BEncode.hs
+++ b/src/Data/BEncode.hs
@@ -68,7 +68,7 @@ class BEncodable a where
68-- bencoding = Iso (Right . toBencode) fromBEncode 68-- bencoding = Iso (Right . toBencode) fromBEncode
69 69
70decodingError :: String -> Result a 70decodingError :: String -> Result a
71decodingError s = Left ("fromBEncode: unable to match " ++ s) 71decodingError s = Left ("fromBEncode: unable to decode " ++ s)
72{-# INLINE decodingError #-} 72{-# INLINE decodingError #-}
73 73
74instance BEncodable BEncode where 74instance BEncodable BEncode where
@@ -182,7 +182,8 @@ reqKey d key
182 182
183optKey :: BEncodable a => Map ByteString BEncode -> ByteString -> Result (Maybe a) 183optKey :: BEncodable a => Map ByteString BEncode -> ByteString -> Result (Maybe a)
184optKey d key 184optKey d key
185 | Just b <- M.lookup key d = Just <$> fromBEncode b 185 | Just b <- M.lookup key d
186 , Right r <- fromBEncode b = return (Just r)
186 | otherwise = return Nothing 187 | otherwise = return Nothing
187 188
188(>--) :: BEncodable a => Map ByteString BEncode -> ByteString -> Result a 189(>--) :: BEncodable a => Map ByteString BEncode -> ByteString -> Result a