From 782458919f42fff8966262e97878e62a235b5c60 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Thu, 21 Jun 2018 13:30:47 -0400 Subject: [PATCH] Add a set of default enabled language extensions. The extensions in this list in the cabal file will be enabled for all source files, so I've only made it the ones that are both widely used and don't do anything weird or potentially unsafe or very slow. Others can be added as needed. This also means the LANGUAGE pragmas for these extensions can be removed from the source files. --- Codec/RPM/Parse.hs | 2 +- Codec/RPM/Tags.hs | 6 +++--- Codec/RPM/Types.hs | 2 -- Codec/RPM/Version.hs | 3 --- codec-rpm.cabal | 10 ++++++++++ examples/rpm2json.hs | 1 - examples/unrpm.hs | 1 - tests/Codec/RPM/Tags_mkTagSpec.hs | 2 +- tests/Codec/RPM/VersionSpec.hs | 2 -- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Codec/RPM/Parse.hs b/Codec/RPM/Parse.hs index 110ce14..b2679f8 100644 --- a/Codec/RPM/Parse.hs +++ b/Codec/RPM/Parse.hs @@ -39,7 +39,7 @@ import Codec.RPM.Tags(Tag, mkTag) import Codec.RPM.Types(Header(..), Lead(..), RPM(..), SectionHeader(..)) -- "a <$> b <$> c" looks better than "a . b <$> c" -{-# ANN parseLead "HLint: ignore Functor law" #-} +{-# ANN parseLead ("HLint: ignore Functor law" :: String) #-} parseLead :: Parser Lead parseLead = do -- Verify this is an RPM by checking the first four bytes. diff --git a/Codec/RPM/Tags.hs b/Codec/RPM/Tags.hs index 15c1c28..e4cb869 100644 --- a/Codec/RPM/Tags.hs +++ b/Codec/RPM/Tags.hs @@ -41,11 +41,11 @@ import Text.PrettyPrint(text) import Codec.RPM.Internal.Numbers -{-# ANN module "HLint: ignore Use camelCase" #-} +{-# ANN module ("HLint: ignore Use camelCase" :: String) #-} -- The character lists are actually lists of characters, ignore the suggestions -- to use String instead -{-# ANN module "HLint: ignore Use String" #-} +{-# ANN module ("HLint: ignore Use String" :: String) #-} -- | A very large data type that holds all the possibilities for the various tags that can -- be contained in an 'Codec.RPM.Types.RPM' 'Codec.RPM.Types.Header'. Each tag describes @@ -772,7 +772,7 @@ mkI18NString store ty offset count | fromIntegral (BS.length store) - offset < c -- I don't know how to split a ByteString up into chunks of a given size, so here's what I'm doing. Take -- a list of offsets of where in the ByteString to read. Skip to each of those offsets, grab size bytes, and -- convert those bytes into the type using the given conversion function. Return that list. -{-# ANN readWords "HLint: ignore Eta reduce" #-} +{-# ANN readWords ("HLint: ignore Eta reduce" :: String) #-} readWords :: BS.ByteString -> Int -> (BS.ByteString -> a) -> [Word32] -> [a] readWords bs size conv offsets = map (\offset -> conv $ BS.take size $ BS.drop (fromIntegral offset) bs) offsets diff --git a/Codec/RPM/Types.hs b/Codec/RPM/Types.hs index e41e441..4f2590a 100644 --- a/Codec/RPM/Types.hs +++ b/Codec/RPM/Types.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE RecordWildCards #-} - -- | -- Module: Codec.RPM.Types -- Copyright: (c) 2016-2017 Red Hat, Inc. diff --git a/Codec/RPM/Version.hs b/Codec/RPM/Version.hs index 6024acc..c691611 100644 --- a/Codec/RPM/Version.hs +++ b/Codec/RPM/Version.hs @@ -1,6 +1,3 @@ -{-# LANGUAGE MultiWayIf #-} -{-# LANGUAGE OverloadedStrings #-} - -- | -- Module: Codec.RPM.Parse -- Copyright: (c) 2017 Red Hat, Inc. diff --git a/codec-rpm.cabal b/codec-rpm.cabal index 97fdf15..1dcde31 100644 --- a/codec-rpm.cabal +++ b/codec-rpm.cabal @@ -53,6 +53,11 @@ library default-language: Haskell2010 + default-extensions: LambdaCase, + MultiWayIf, + OverloadedStrings, + RecordWildCards + ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -90,6 +95,11 @@ test-suite tests default-language: Haskell2010 + default-extensions: LambdaCase, + MultiWayIf, + OverloadedStrings, + RecordWildCards + ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates diff --git a/examples/rpm2json.hs b/examples/rpm2json.hs index c2eb51e..9c25349 100644 --- a/examples/rpm2json.hs +++ b/examples/rpm2json.hs @@ -15,7 +15,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE OverloadedStrings #-} import Conduit((.|), Conduit, Consumer, awaitForever, runConduit, stdinC, yield) import Control.Monad(void) diff --git a/examples/unrpm.hs b/examples/unrpm.hs index 876f9e3..cd68e58 100644 --- a/examples/unrpm.hs +++ b/examples/unrpm.hs @@ -13,7 +13,6 @@ -- You should have received a copy of the GNU Lesser General Public -- License along with this library; if not, see . -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RankNTypes #-} import Conduit((.|), Conduit, MonadResource, Producer, awaitForever, runConduitRes, sinkFile, sourceLazy, sourceFile, yield) diff --git a/tests/Codec/RPM/Tags_mkTagSpec.hs b/tests/Codec/RPM/Tags_mkTagSpec.hs index 59c9777..a41a32d 100644 --- a/tests/Codec/RPM/Tags_mkTagSpec.hs +++ b/tests/Codec/RPM/Tags_mkTagSpec.hs @@ -6,7 +6,7 @@ import Codec.RPM.Tags(mkTag, Tag(..), Null(..)) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BC -{-# ANN module "HLint: ignore Reduce duplication" #-} +{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} spec :: Spec spec = describe "Codec.RPM.Tags.mkTag" $ do diff --git a/tests/Codec/RPM/VersionSpec.hs b/tests/Codec/RPM/VersionSpec.hs index 19348fc..3c036fd 100644 --- a/tests/Codec/RPM/VersionSpec.hs +++ b/tests/Codec/RPM/VersionSpec.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE OverloadedStrings #-} - module Codec.RPM.VersionSpec (spec) where import Test.Hspec