Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

Commit

Permalink
Add a set of default enabled language extensions.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
clumens committed Jun 22, 2018
1 parent cf4e0d0 commit 7824589
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Codec/RPM/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions Codec/RPM/Tags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions Codec/RPM/Types.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE RecordWildCards #-}

-- |
-- Module: Codec.RPM.Types
-- Copyright: (c) 2016-2017 Red Hat, Inc.
Expand Down
3 changes: 0 additions & 3 deletions Codec/RPM/Version.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}

-- |
-- Module: Codec.RPM.Parse
-- Copyright: (c) 2017 Red Hat, Inc.
Expand Down
10 changes: 10 additions & 0 deletions codec-rpm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ library

default-language: Haskell2010

default-extensions: LambdaCase,
MultiWayIf,
OverloadedStrings,
RecordWildCards

ghc-options: -Wall
-Wincomplete-uni-patterns
-Wincomplete-record-updates
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/rpm2json.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion examples/unrpm.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, see <http://www.gnu.org/licenses/>.

{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE RankNTypes #-}

import Conduit((.|), Conduit, MonadResource, Producer, awaitForever, runConduitRes, sinkFile, sourceLazy, sourceFile, yield)
Expand Down
2 changes: 1 addition & 1 deletion tests/Codec/RPM/Tags_mkTagSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/Codec/RPM/VersionSpec.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE OverloadedStrings #-}

module Codec.RPM.VersionSpec (spec) where

import Test.Hspec
Expand Down

0 comments on commit 7824589

Please sign in to comment.