Skip to content

Commit

Permalink
Use GHC2021
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Feb 16, 2021
1 parent f0f77d6 commit d32ea25
Show file tree
Hide file tree
Showing 39 changed files with 86 additions and 109 deletions.
1 change: 0 additions & 1 deletion .ghci

This file was deleted.

57 changes: 57 additions & 0 deletions hpack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ source-repository head
library
hs-source-dirs:
src
default-extensions: BangPatterns ConstrainedClassMethods DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveTraversable ExistentialQuantification ExplicitForAll FlexibleContexts FlexibleInstances GeneralizedNewtypeDeriving KindSignatures MultiParamTypeClasses NamedFieldPuns PostfixOperators RankNTypes ScopedTypeVariables StandaloneDeriving TupleSections TypeOperators TypeSynonymInstances DeriveAnyClass DerivingStrategies LambdaCase OverloadedStrings RecordWildCards ViewPatterns DefaultSignatures
ghc-options: -Wall
build-depends:
Cabal >=3.0.0.0 && <3.6
Expand All @@ -49,6 +50,24 @@ library
, unordered-containers
, vector
, yaml >=0.10.0
if impl(ghc >= 8.10)
default-extensions: ImportQualifiedPost StandaloneKindSignatures
if impl(ghc >= 8.6)
default-extensions: NumericUnderscores
if impl(ghc >= 8.4)
default-extensions: EmptyDataDeriving HexFloatLiterals
if impl(ghc >= 8.0)
default-extensions: DeriveLift TypeApplications
if impl(ghc >= 7.10)
default-extensions: BinaryLiterals NamedWildCards
if impl(ghc >= 7.8)
default-extensions: EmptyCase
if impl(ghc >= 7.6)
default-extensions: InstanceSigs
if impl(ghc >= 7.4)
default-extensions: ConstraintKinds PolyKinds
if impl(ghc >= 7.2)
default-extensions: DeriveGeneric GADTSyntax
exposed-modules:
Hpack
Hpack.Config
Expand Down Expand Up @@ -83,6 +102,7 @@ executable hpack
main-is: Main.hs
hs-source-dirs:
driver
default-extensions: BangPatterns ConstrainedClassMethods DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveTraversable ExistentialQuantification ExplicitForAll FlexibleContexts FlexibleInstances GeneralizedNewtypeDeriving KindSignatures MultiParamTypeClasses NamedFieldPuns PostfixOperators RankNTypes ScopedTypeVariables StandaloneDeriving TupleSections TypeOperators TypeSynonymInstances DeriveAnyClass DerivingStrategies LambdaCase OverloadedStrings RecordWildCards ViewPatterns DefaultSignatures
ghc-options: -Wall
build-depends:
Cabal >=3.0.0.0 && <3.6
Expand All @@ -108,6 +128,24 @@ executable hpack
, unordered-containers
, vector
, yaml >=0.10.0
if impl(ghc >= 8.10)
default-extensions: ImportQualifiedPost StandaloneKindSignatures
if impl(ghc >= 8.6)
default-extensions: NumericUnderscores
if impl(ghc >= 8.4)
default-extensions: EmptyDataDeriving HexFloatLiterals
if impl(ghc >= 8.0)
default-extensions: DeriveLift TypeApplications
if impl(ghc >= 7.10)
default-extensions: BinaryLiterals NamedWildCards
if impl(ghc >= 7.8)
default-extensions: EmptyCase
if impl(ghc >= 7.6)
default-extensions: InstanceSigs
if impl(ghc >= 7.4)
default-extensions: ConstraintKinds PolyKinds
if impl(ghc >= 7.2)
default-extensions: DeriveGeneric GADTSyntax
other-modules:
Paths_hpack
default-language: Haskell2010
Expand All @@ -118,6 +156,7 @@ test-suite spec
hs-source-dirs:
test
src
default-extensions: BangPatterns ConstrainedClassMethods DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveTraversable ExistentialQuantification ExplicitForAll FlexibleContexts FlexibleInstances GeneralizedNewtypeDeriving KindSignatures MultiParamTypeClasses NamedFieldPuns PostfixOperators RankNTypes ScopedTypeVariables StandaloneDeriving TupleSections TypeOperators TypeSynonymInstances DeriveAnyClass DerivingStrategies LambdaCase OverloadedStrings RecordWildCards ViewPatterns DefaultSignatures QuasiQuotes
ghc-options: -Wall
cpp-options: -DTEST
build-depends:
Expand Down Expand Up @@ -150,6 +189,24 @@ test-suite spec
, unordered-containers
, vector
, yaml >=0.10.0
if impl(ghc >= 8.10)
default-extensions: ImportQualifiedPost StandaloneKindSignatures
if impl(ghc >= 8.6)
default-extensions: NumericUnderscores
if impl(ghc >= 8.4)
default-extensions: EmptyDataDeriving HexFloatLiterals
if impl(ghc >= 8.0)
default-extensions: DeriveLift TypeApplications
if impl(ghc >= 7.10)
default-extensions: BinaryLiterals NamedWildCards
if impl(ghc >= 7.8)
default-extensions: EmptyCase
if impl(ghc >= 7.6)
default-extensions: InstanceSigs
if impl(ghc >= 7.4)
default-extensions: ConstraintKinds PolyKinds
if impl(ghc >= 7.2)
default-extensions: DeriveGeneric GADTSyntax
build-tool-depends:
hspec-discover:hspec-discover
other-modules:
Expand Down
13 changes: 13 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ extra-source-files:

ghc-options: -Wall

defaults: sol/[email protected]

default-extensions:
- DeriveAnyClass
- DerivingStrategies
- LambdaCase
- OverloadedStrings
- RecordWildCards
- ViewPatterns
- DefaultSignatures

dependencies:
- base >= 4.9 && < 5
- bytestring
Expand Down Expand Up @@ -64,3 +75,5 @@ tests:
- template-haskell
- HUnit >= 1.6.0.0
build-tools: hspec-discover
default-extensions:
- QuasiQuotes
7 changes: 0 additions & 7 deletions src/Data/Aeson/Config/FromValue.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE RecordWildCards #-}

{-# LANGUAGE ConstraintKinds #-}
module Data.Aeson.Config.FromValue (
FromValue(..)
, Parser
Expand Down
5 changes: 1 addition & 4 deletions src/Data/Aeson/Config/Parser.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Data.Aeson.Config.Parser (
Parser
Expand Down Expand Up @@ -65,7 +62,7 @@ fromAesonPathElement e = case e of
Aeson.Index n -> Index n

newtype Parser a = Parser {unParser :: WriterT (Set JSONPath) Aeson.Parser a}
deriving (Functor, Applicative, Alternative, Monad, Fail.MonadFail)
deriving newtype (Functor, Applicative, Alternative, Monad, Fail.MonadFail)

liftParser :: Aeson.Parser a -> Parser a
liftParser = Parser . lift
Expand Down
7 changes: 2 additions & 5 deletions src/Data/Aeson/Config/Types.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Data.Aeson.Config.Types where

import Data.Semigroup (Semigroup(..))
Expand All @@ -12,7 +8,8 @@ import Data.Bifunctor
import Data.Aeson.Config.FromValue

newtype List a = List {fromList :: [a]}
deriving (Eq, Show, Functor, Foldable, Traversable, Semigroup, Monoid)
deriving newtype (Eq, Show, Functor, Foldable, Semigroup, Monoid)
deriving (Traversable)

instance FromValue a => FromValue (List a) where
fromValue v = List <$> case v of
Expand Down
2 changes: 0 additions & 2 deletions src/Hpack.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RecordWildCards #-}
module Hpack (
-- | /__NOTE:__/ This module is exposed to allow integration of Hpack into
-- other tools. It is not meant for general use by end users. The following
Expand Down
3 changes: 0 additions & 3 deletions src/Hpack/CabalFile.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
module Hpack.CabalFile where

import Control.Monad
Expand Down
17 changes: 2 additions & 15 deletions src/Hpack/Config.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleContexts #-}
module Hpack.Config (
-- | /__NOTE:__/ This module is exposed to allow integration of Hpack into
-- other tools. It is not meant for general use by end users. The following
Expand Down Expand Up @@ -469,7 +455,8 @@ hasKey _ _ = False

newtype Condition = Condition {
conditionCondition :: Cond
} deriving (Eq, Show, Generic, FromValue)
} deriving (Eq, Show, Generic)
deriving anyclass FromValue

data Cond = CondBool Bool | CondExpression String
deriving (Eq, Show)
Expand Down
4 changes: 0 additions & 4 deletions src/Hpack/Defaults.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE LambdaCase #-}
module Hpack.Defaults (
ensure
, Defaults(..)
Expand Down
3 changes: 0 additions & 3 deletions src/Hpack/License.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE LambdaCase #-}
module Hpack.License where

import Control.Arrow ((&&&))
Expand Down
2 changes: 0 additions & 2 deletions src/Hpack/Module.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE CPP #-}
module Hpack.Module (
Module(..)
Expand Down
1 change: 0 additions & 1 deletion src/Hpack/Options.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE LambdaCase #-}
module Hpack.Options where

import Control.Applicative
Expand Down
4 changes: 0 additions & 4 deletions src/Hpack/Render.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE CPP #-}
module Hpack.Render (
-- | /__NOTE:__/ This module is exposed to allow integration of Hpack into
Expand Down
6 changes: 2 additions & 4 deletions src/Hpack/Render/Dsl.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hpack.Render.Dsl (
-- * AST
Element (..)
Expand Down Expand Up @@ -44,10 +42,10 @@ data CommaStyle = LeadingCommas | TrailingCommas
deriving (Eq, Show)

newtype Nesting = Nesting Int
deriving (Eq, Show, Num, Enum)
deriving newtype (Eq, Show, Num, Enum)

newtype Alignment = Alignment Int
deriving (Eq, Show, Num)
deriving newtype (Eq, Show, Num)

data RenderSettings = RenderSettings {
renderSettingsIndentation :: Int
Expand Down
1 change: 0 additions & 1 deletion src/Hpack/Render/Hints.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
module Hpack.Render.Hints (
FormattingHints (..)
, sniffFormattingHints
Expand Down
7 changes: 2 additions & 5 deletions src/Hpack/Syntax/BuildTools.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ViewPatterns #-}
module Hpack.Syntax.BuildTools (
BuildTools(..)
, ParseBuildTool(..)
Expand Down Expand Up @@ -33,7 +30,7 @@ data ParseBuildTool = QualifiedBuildTool String String | UnqualifiedBuildTool St

newtype BuildTools = BuildTools {
unBuildTools :: [(ParseBuildTool, DependencyVersion)]
} deriving (Show, Eq, Semigroup, Monoid)
} deriving newtype (Show, Eq, Semigroup, Monoid)

instance FromValue BuildTools where
fromValue = fmap BuildTools . parseDependencies parse
Expand Down Expand Up @@ -68,7 +65,7 @@ instance FromValue BuildTools where

newtype SystemBuildTools = SystemBuildTools {
unSystemBuildTools :: Map String VersionConstraint
} deriving (Show, Eq, Semigroup, Monoid)
} deriving newtype (Show, Eq, Semigroup, Monoid)

instance FromValue SystemBuildTools where
fromValue = fmap (SystemBuildTools . Map.fromList) . parseDependencies parse
Expand Down
4 changes: 0 additions & 4 deletions src/Hpack/Syntax/Defaults.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Hpack.Syntax.Defaults (
Defaults(..)
, Github(..)
Expand Down
4 changes: 1 addition & 3 deletions src/Hpack/Syntax/Dependencies.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
module Hpack.Syntax.Dependencies (
Dependencies(..)
Expand Down Expand Up @@ -34,7 +32,7 @@ import Hpack.Syntax.ParseDependencies

newtype Dependencies = Dependencies {
unDependencies :: Map String DependencyInfo
} deriving (Eq, Show, Semigroup, Monoid)
} deriving newtype (Eq, Show, Semigroup, Monoid)

instance IsList Dependencies where
type Item Dependencies = (String, DependencyInfo)
Expand Down
3 changes: 0 additions & 3 deletions src/Hpack/Syntax/DependencyVersion.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
module Hpack.Syntax.DependencyVersion (
githubBaseUrl
, GitRef
Expand Down
5 changes: 4 additions & 1 deletion src/Hpack/Syntax/Git.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ isValidRef ref =
&& not (any (isPrefixOf ".") components)
&& not (".." `isInfixOf` ref)
&& not (any isControl ref)
&& all (`notElem` " ~^:?*[\\") ref
&& all (`notElem` special) ref
&& not ("//" `isInfixOf` ref)
&& not ("/" `isPrefixOf` ref)
&& not ("/" `isSuffixOf` ref)
&& not ("." `isSuffixOf` ref)
&& not ("@{" `isInfixOf` ref)
&& not (ref == "@")
where
special :: String
special = " ~^:?*[\\"

components = splitDirectories ref

isControl :: Char -> Bool
Expand Down
2 changes: 0 additions & 2 deletions src/Hpack/Syntax/ParseDependencies.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Hpack.Syntax.ParseDependencies where

import Data.Text (Text)
Expand Down
1 change: 0 additions & 1 deletion src/Hpack/Util.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE LambdaCase #-}
module Hpack.Util (
GhcOption
, GhcProfOption
Expand Down
2 changes: 0 additions & 2 deletions src/Hpack/Yaml.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
module Hpack.Yaml (
-- | /__NOTE:__/ This module is exposed to allow integration of Hpack into
-- other tools. It is not meant for general use by end users. The following
Expand Down
7 changes: 1 addition & 6 deletions test/Data/Aeson/Config/FromValueSpec.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ConstraintKinds #-}
module Data.Aeson.Config.FromValueSpec where

import Helper
Expand Down Expand Up @@ -120,4 +115,4 @@ spec = do
region: somewhere
zip: '123456'
foo: bar
|] `shouldDecodeTo` Right (Map.fromList [("Joe", Address "somewhere" "123456")], ["$.Joe.foo"])
|] `shouldDecodeTo` Right (Map.fromList [("Joe" :: String, Address "somewhere" "123456")], ["$.Joe.foo"])
1 change: 0 additions & 1 deletion test/Data/Aeson/Config/TypesSpec.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE QuasiQuotes #-}
module Data.Aeson.Config.TypesSpec (spec) where

import Helper
Expand Down
Loading

0 comments on commit d32ea25

Please sign in to comment.