From 8017336edbbfb4ab52ac3ab2309c286842e8f6a2 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Wed, 28 Mar 2018 22:48:44 -0400 Subject: Clean up hlint warnings --- Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs | 17 +++++++++-------- Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs | 10 +++++----- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'Codec') diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs b/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs index b62ff6a..5d28e46 100644 --- a/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs +++ b/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs @@ -25,6 +25,7 @@ import qualified Data.ByteString.Char8 as BC8 import qualified Data.ByteString.Base64 as Base64 import Data.Digest.CRC24 (crc24) import Data.Binary.Get (Get, runGetOrFail, getWord8) +import Data.Functor (($>)) import Data.String (IsString, fromString) import Data.Word (Word32) @@ -75,10 +76,10 @@ beginLine = do _ <- lineEnding "line ending" return atype where - message = string "MESSAGE" *> return ArmorMessage - pubkey = string "PUBLIC KEY BLOCK" *> return ArmorPublicKeyBlock - privkey = string "PRIVATE KEY BLOCK" *> return ArmorPrivateKeyBlock - signature = string "SIGNATURE" *> return ArmorSignature + message = string "MESSAGE" $> ArmorMessage + pubkey = string "PUBLIC KEY BLOCK" $> ArmorPublicKeyBlock + privkey = string "PRIVATE KEY BLOCK" $> ArmorPrivateKeyBlock + signature = string "SIGNATURE" $> ArmorSignature parts = string "MESSAGE, PART " *> (partsdef <|> partsindef) partsdef = do firstnum <- num @@ -113,12 +114,12 @@ endLine atype = do lineEnding aType :: ArmorType -> B.ByteString -aType (ArmorMessage) = BC8.pack "MESSAGE" -aType (ArmorPublicKeyBlock) = BC8.pack "PUBLIC KEY BLOCK" -aType (ArmorPrivateKeyBlock) = BC8.pack "PRIVATE KEY BLOCK" +aType ArmorMessage = BC8.pack "MESSAGE" +aType ArmorPublicKeyBlock = BC8.pack "PUBLIC KEY BLOCK" +aType ArmorPrivateKeyBlock = BC8.pack "PRIVATE KEY BLOCK" aType (ArmorSplitMessage x y) = BC8.pack "MESSAGE, PART " `B.append` l2s x `B.append` BC8.singleton '/' `B.append` l2s y aType (ArmorSplitMessageIndefinite x) = BC8.pack "MESSAGE, PART " `B.append` l2s x -aType (ArmorSignature) = BC8.pack "SIGNATURE" +aType ArmorSignature = BC8.pack "SIGNATURE" l2s :: BL.ByteString -> B.ByteString l2s = B.concat . BL.toChunks diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs b/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs index fdb9961..cb5b16d 100644 --- a/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs +++ b/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs @@ -37,15 +37,15 @@ endLine :: ArmorType -> ByteString endLine atype = BLC8.pack "-----END PGP " `BL.append` aType atype `BL.append` BLC8.pack "-----\n" aType :: ArmorType -> ByteString -aType (ArmorMessage) = BLC8.pack "MESSAGE" -aType (ArmorPublicKeyBlock) = BLC8.pack "PUBLIC KEY BLOCK" -aType (ArmorPrivateKeyBlock) = BLC8.pack "PRIVATE KEY BLOCK" +aType ArmorMessage = BLC8.pack "MESSAGE" +aType ArmorPublicKeyBlock = BLC8.pack "PUBLIC KEY BLOCK" +aType ArmorPrivateKeyBlock = BLC8.pack "PRIVATE KEY BLOCK" aType (ArmorSplitMessage x y) = BLC8.pack $ "MESSAGE, PART " ++ show x ++ "/" ++ show y aType (ArmorSplitMessageIndefinite x) = BLC8.pack $ "MESSAGE, PART " ++ show x -aType (ArmorSignature) = BLC8.pack "SIGNATURE" +aType ArmorSignature = BLC8.pack "SIGNATURE" armorHeaders :: [(String, String)] -> ByteString -armorHeaders ahs = BLC8.unlines . map armorHeader $ ahs +armorHeaders = BLC8.unlines . map armorHeader where armorHeader :: (String, String) -> ByteString armorHeader (k, v) = BLC8.pack k `BL.append` BLC8.pack ": " `BL.append` BLC8.pack v -- cgit v1.2.3