diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-08-11 13:00:01 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-08-11 13:00:01 +0200 |
| commit | 42b9b671e1db2ac182ad504b14da9a0f6bb2ff1a (patch) | |
| tree | 24a832e73cd822ff6ed3d118159be20d1168b14f | |
| parent | e0ca80db32c659ba79eef532af144f03a2c1b6aa (diff) | |
| download | slackbuilder-42b9b671e1db2ac182ad504b14da9a0f6bb2ff1a.tar.gz | |
Fix GHC 9.8 warnings
| -rw-r--r-- | lib/SlackBuilder/Info.hs | 8 | ||||
| -rw-r--r-- | tests/SlackBuilder/InfoSpec.hs | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/SlackBuilder/Info.hs b/lib/SlackBuilder/Info.hs index 7617e15..e2f5018 100644 --- a/lib/SlackBuilder/Info.hs +++ b/lib/SlackBuilder/Info.hs @@ -65,9 +65,11 @@ packageDownloads variableName = string (variableName <> "=\"") <* string "\"\n" hexDigit :: GenParser Word8 -hexDigit = - let digitPair = count 2 hexDigitChar - in fst . head . readHex . fmap (toEnum . fromIntegral) <$> digitPair +hexDigit = count 2 hexDigitChar + >>= extractNumber . readHex . fmap (toEnum . fromIntegral) + where + extractNumber [(number, "")] = pure number + extractNumber _ = fail "Unable to convert a 2-digit hexadecimal number" packageChecksum :: GenParser ByteString packageChecksum = ByteString.pack <$> count 16 hexDigit diff --git a/tests/SlackBuilder/InfoSpec.hs b/tests/SlackBuilder/InfoSpec.hs index c05aa3e..8dd0097 100644 --- a/tests/SlackBuilder/InfoSpec.hs +++ b/tests/SlackBuilder/InfoSpec.hs @@ -65,8 +65,8 @@ spec = do in parseInfoFile' infoDownload1 `parseSatisfies` condition it "translates checksum characters into the binary format" $ - let expected = "0102030405060708090a0b0c0d0e0f10" - condition = (== expected) . show . head . checksums + let expected = ["0102030405060708090a0b0c0d0e0f10"] + condition = (== expected) . fmap show . checksums in parseInfoFile' infoDownload1 `parseSatisfies` condition it "accepts an empty downloads list" $ |
