Skip to content

Commit

Permalink
Fix -Wincomplete-uni-patterns error in stream decoding
Browse files Browse the repository at this point in the history
Function decodeValue in stream decogin was written using
two functions in a way that it provided temporary value
that had a incomplete match. While it's on two have such
matching because we build only well formed value, but it
can't be proven by the compiler. In this commit we inline
those functions removing a error.
  • Loading branch information
qnikst committed Jun 10, 2023
1 parent ef69e09 commit 9c0ebfb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Database/Redis/ManualCommands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1080,9 +1080,8 @@ instance RedisResult StreamsRecord where
return StreamsRecord{..}
where
decodeKeyValues :: [ByteString] -> [(ByteString, ByteString)]
decodeKeyValues bs = map (\[x,y] -> (x,y)) $ chunksOfTwo bs
chunksOfTwo (x:y:rest) = [x,y]:chunksOfTwo rest
chunksOfTwo _ = []
decodeKeyValues (x:y:rest) = (x,y):decodeKeyValues rest
decodeKeyValues _ = []
decode a = Left a

data XReadOpts = XReadOpts
Expand Down

0 comments on commit 9c0ebfb

Please sign in to comment.