diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index b8cad329..a4090e5c 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/andreasabel/haskell-ci # -# version: 0.17.20231112 +# version: 0.17.20240106 # -# REGENDATA ("0.17.20231112",["github","cabal.project"]) +# REGENDATA ("0.17.20240106",["github","cabal.project"]) # name: Haskell-CI on: @@ -87,32 +87,17 @@ jobs: compilerVersion: 8.0.2 setup-method: ghcup allow-failure: false - - compiler: ghc-7.10.3 - compilerKind: ghc - compilerVersion: 7.10.3 - setup-method: hvr-ppa - allow-failure: false fail-fast: false steps: - name: apt run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev - if [ "${{ matrix.setup-method }}" = ghcup ]; then - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - else - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y "$HCNAME" - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -124,22 +109,13 @@ jobs: echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - else - HC=$HCDIR/bin/$HCKIND - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" - echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - fi - + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" diff --git a/example-client/example-client.cabal b/example-client/example-client.cabal index 123e7c51..7d4a86ef 100644 --- a/example-client/example-client.cabal +++ b/example-client/example-client.cabal @@ -23,7 +23,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 flag use-network-uri description: Are we using network-uri? @@ -36,14 +35,14 @@ flag Cabal-syntax executable example-client main-is: Main.hs - other-modules: Prelude ExampleClient.Options + other-modules: ExampleClient.Options - build-depends: base >= 4.5 && < 4.20, + build-depends: base >= 4.9 && < 4.20, bytestring >= 0.9, - directory >= 1.1, + directory >= 1.2, filepath >= 1.2, optparse-applicative >= 0.11, - time >= 1.2, + time >= 1.5, hackage-security >= 0.5, hackage-security-HTTP, hackage-security-curl, diff --git a/example-client/src/Prelude.hs b/example-client/src/Prelude.hs deleted file mode 100644 index 331ff6ec..00000000 --- a/example-client/src/Prelude.hs +++ /dev/null @@ -1,27 +0,0 @@ --- | Smooth over differences between various ghc versions by making older --- preludes look like 4.8.0 -{-# LANGUAGE PackageImports #-} -{-# LANGUAGE CPP #-} -module Prelude ( - module P -#if !MIN_VERSION_base(4,8,0) - , Applicative(..) - , Monoid(..) - , (<$>) - , (<$) - , traverse -#endif - ) where - -#if MIN_VERSION_base(4,8,0) -import "base" Prelude as P -#else -#if MIN_VERSION_base(4,6,0) -import "base" Prelude as P -#else -import "base" Prelude as P hiding (catch) -#endif -import Control.Applicative -import Data.Monoid -import Data.Traversable (traverse) -#endif diff --git a/hackage-repo-tool/ChangeLog.md b/hackage-repo-tool/ChangeLog.md index fbb14f70..ec9b8f5a 100644 --- a/hackage-repo-tool/ChangeLog.md +++ b/hackage-repo-tool/ChangeLog.md @@ -1,3 +1,7 @@ +Unreleased +---------- +* Drop support for GHC 7. + 0.1.1.3 ------- * Compat release for `Cabal-syntax-3.8.1.0` diff --git a/hackage-repo-tool/hackage-repo-tool.cabal b/hackage-repo-tool/hackage-repo-tool.cabal index d2cc5e71..230ec9ea 100644 --- a/hackage-repo-tool/hackage-repo-tool.cabal +++ b/hackage-repo-tool/hackage-repo-tool.cabal @@ -35,7 +35,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 extra-source-files: ChangeLog.md README.md @@ -48,10 +47,6 @@ flag use-network-uri description: Are we using @network-uri@? manual: False -flag use-old-time - description: Are we using @old-time@? - manual: False - flag Cabal-syntax description: Are we using Cabal-syntax? manual: False @@ -65,24 +60,17 @@ executable hackage-repo-tool Hackage.Security.RepoTool.Layout.Keys Hackage.Security.RepoTool.Paths Hackage.Security.RepoTool.Util.IO - Prelude -- For boot libraries we try to accomodate the versions bundled with -- the respective GHC release - build-depends: base >= 4.5 && < 4.20, + build-depends: base >= 4.9 && < 4.20, bytestring >= 0.9 && < 0.13, - directory >= 1.1 && < 1.4, + directory >= 1.2 && < 1.4, filepath >= 1.3 && < 1.5, - time >= 1.4 && < 1.13 + time >= 1.5 && < 1.13 if !os(windows) build-depends: unix >= 2.5 && < 2.9 - if flag(use-old-time) - build-depends: directory < 1.2 - , old-time == 1.1.* - else - build-depends: directory >= 1.2 - -- For non-boot libraries we try to support single major versions -- to reduce the risk of semantic differences build-depends: microlens >= 0.4.11.2 && < 0.5, diff --git a/hackage-repo-tool/src/Hackage/Security/RepoTool/Util/IO.hs b/hackage-repo-tool/src/Hackage/Security/RepoTool/Util/IO.hs index b6cd0312..1cc7baed 100644 --- a/hackage-repo-tool/src/Hackage/Security/RepoTool/Util/IO.hs +++ b/hackage-repo-tool/src/Hackage/Security/RepoTool/Util/IO.hs @@ -34,11 +34,7 @@ import System.Posix.Types (EpochTime) import qualified System.Posix.Files as Posix #endif -#if MIN_VERSION_directory(1,2,0) import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds) -#else -import System.Time (ClockTime (TOD)) -#endif -- | Get the modification time of the specified file -- @@ -50,13 +46,8 @@ getFileModTime opts repoLoc targetPath = -- from POSIX seconds, so there shouldn't be loss of precision. -- NB: Apparently, this has low clock resolution on GHC < 7.8. -- I don't think we care. -#if MIN_VERSION_directory(1,2,0) fromInteger . floor . utcTimeToPOSIXSeconds <$> Directory.getModificationTime (toFilePath fp) -#else - Directory.getModificationTime (toFilePath fp) >>= \(TOD s _) -> - return (fromInteger s) -#endif where fp :: Path Absolute fp = anchorTargetPath' opts repoLoc targetPath @@ -123,11 +114,6 @@ data TarGzError = TarGzError FilePath SomeException deriving (Typeable) instance Exception TarGzError where -#if MIN_VERSION_base(4,8,0) displayException (TarGzError path e) = path ++ ": " ++ displayException e deriving instance Show TarGzError -#else -instance Show TarGzError where - show (TarGzError path e) = path ++ ": " ++ show e -#endif diff --git a/hackage-repo-tool/src/Main.hs b/hackage-repo-tool/src/Main.hs index 3615c6f8..e871b4de 100644 --- a/hackage-repo-tool/src/Main.hs +++ b/hackage-repo-tool/src/Main.hs @@ -77,11 +77,6 @@ topLevelExceptionHandler e = do putStrLn $ displayException e exitFailure -#if !MIN_VERSION_base(4,8,0) -displayException :: Exception e => e -> String -displayException = show -#endif - {------------------------------------------------------------------------------- Creating keys -------------------------------------------------------------------------------} diff --git a/hackage-repo-tool/src/Prelude.hs b/hackage-repo-tool/src/Prelude.hs deleted file mode 100644 index 331ff6ec..00000000 --- a/hackage-repo-tool/src/Prelude.hs +++ /dev/null @@ -1,27 +0,0 @@ --- | Smooth over differences between various ghc versions by making older --- preludes look like 4.8.0 -{-# LANGUAGE PackageImports #-} -{-# LANGUAGE CPP #-} -module Prelude ( - module P -#if !MIN_VERSION_base(4,8,0) - , Applicative(..) - , Monoid(..) - , (<$>) - , (<$) - , traverse -#endif - ) where - -#if MIN_VERSION_base(4,8,0) -import "base" Prelude as P -#else -#if MIN_VERSION_base(4,6,0) -import "base" Prelude as P -#else -import "base" Prelude as P hiding (catch) -#endif -import Control.Applicative -import Data.Monoid -import Data.Traversable (traverse) -#endif diff --git a/hackage-root-tool/Main.hs b/hackage-root-tool/Main.hs index 7dff1fc2..da80d596 100644 --- a/hackage-root-tool/Main.hs +++ b/hackage-root-tool/Main.hs @@ -49,11 +49,6 @@ topLevelExceptionHandler e = do putStrLn $ displayException e exitFailure -#if !MIN_VERSION_base(4,8,0) -displayException :: Exception e => e -> String -displayException = show -#endif - {------------------------------------------------------------------------------- Creating keys -------------------------------------------------------------------------------} diff --git a/hackage-root-tool/hackage-root-tool.cabal b/hackage-root-tool/hackage-root-tool.cabal index 11c6b689..fd737022 100644 --- a/hackage-root-tool/hackage-root-tool.cabal +++ b/hackage-root-tool/hackage-root-tool.cabal @@ -27,7 +27,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 extra-source-files: ChangeLog.md @@ -39,7 +38,7 @@ source-repository head executable hackage-root-tool main-is: Main.hs - build-depends: base >= 4.4 && < 5, + build-depends: base >= 4.9 && < 5, filepath >= 1.2 && < 1.5, optparse-applicative >= 0.11 && < 0.18, hackage-security >= 0.5 && < 0.7 diff --git a/hackage-security-HTTP/ChangeLog.md b/hackage-security-HTTP/ChangeLog.md index f6369ba2..14323bd7 100644 --- a/hackage-security-HTTP/ChangeLog.md +++ b/hackage-security-HTTP/ChangeLog.md @@ -1,3 +1,8 @@ +Unreleased +---------- +* Drop support for GHC 7. + + 0.1.1.1 ------- * Add support for hackage-security-0.6 diff --git a/hackage-security-HTTP/hackage-security-HTTP.cabal b/hackage-security-HTTP/hackage-security-HTTP.cabal index 127d9d33..94db4a0c 100644 --- a/hackage-security-HTTP/hackage-security-HTTP.cabal +++ b/hackage-security-HTTP/hackage-security-HTTP.cabal @@ -29,7 +29,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 extra-source-files: ChangeLog.md @@ -44,7 +43,7 @@ flag use-network-uri library exposed-modules: Hackage.Security.Client.Repository.HttpLib.HTTP - build-depends: base >= 4.5 && < 4.20, + build-depends: base >= 4.9 && < 4.20, bytestring >= 0.9 && < 0.13, HTTP >= 4000.2.19 && < 4000.5, mtl >= 2.1 && < 2.4, diff --git a/hackage-security-HTTP/src/Hackage/Security/Client/Repository/HttpLib/HTTP.hs b/hackage-security-HTTP/src/Hackage/Security/Client/Repository/HttpLib/HTTP.hs index e17d3fcb..dd3ca6f7 100644 --- a/hackage-security-HTTP/src/Hackage/Security/Client/Repository/HttpLib/HTTP.hs +++ b/hackage-security-HTTP/src/Hackage/Security/Client/Repository/HttpLib/HTTP.hs @@ -133,17 +133,10 @@ instance Pretty UnexpectedResponse where instance Pretty InvalidProxy where pretty (InvalidProxy p) = "Invalid proxy " ++ show p -#if MIN_VERSION_base(4,8,0) deriving instance Show UnexpectedResponse deriving instance Show InvalidProxy instance Exception UnexpectedResponse where displayException = pretty instance Exception InvalidProxy where displayException = pretty -#else -instance Show UnexpectedResponse where show = pretty -instance Show InvalidProxy where show = pretty -instance Exception UnexpectedResponse -instance Exception InvalidProxy -#endif {------------------------------------------------------------------------------- Additional operations diff --git a/hackage-security-curl/hackage-security-curl.cabal b/hackage-security-curl/hackage-security-curl.cabal index 4e72ca16..f0fb8cd1 100644 --- a/hackage-security-curl/hackage-security-curl.cabal +++ b/hackage-security-curl/hackage-security-curl.cabal @@ -27,7 +27,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 flag use-network-uri description: Are we using network-uri? @@ -35,7 +34,7 @@ flag use-network-uri library exposed-modules: Hackage.Security.Client.Repository.HttpLib.Curl - build-depends: base >= 4.5 && < 4.20, + build-depends: base >= 4.9 && < 4.20, bytestring >= 0.9, process >= 1.1, hackage-security diff --git a/hackage-security-http-client/ChangeLog.md b/hackage-security-http-client/ChangeLog.md index 6809164d..86e9f2fd 100644 --- a/hackage-security-http-client/ChangeLog.md +++ b/hackage-security-http-client/ChangeLog.md @@ -1,3 +1,7 @@ +Unreleased +---------- +* Drop support for GHC 7. + 0.1.1 ----- * Implement updated HttpLib API from hackage-security 0.5 diff --git a/hackage-security-http-client/hackage-security-http-client.cabal b/hackage-security-http-client/hackage-security-http-client.cabal index bdf0e8bc..51c76f30 100644 --- a/hackage-security-http-client/hackage-security-http-client.cabal +++ b/hackage-security-http-client/hackage-security-http-client.cabal @@ -26,7 +26,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 flag use-network-uri description: Are we using network-uri? @@ -34,7 +33,7 @@ flag use-network-uri library exposed-modules: Hackage.Security.Client.Repository.HttpLib.HttpClient - build-depends: base >= 4.5 && < 4.20, + build-depends: base >= 4.9 && < 4.20, bytestring >= 0.9, http-client >= 0.4 && < 0.8, http-types >= 0.8, diff --git a/hackage-security/ChangeLog.md b/hackage-security/ChangeLog.md index 90f43dcd..8a66ba47 100644 --- a/hackage-security/ChangeLog.md +++ b/hackage-security/ChangeLog.md @@ -1,5 +1,11 @@ See also http://pvp.haskell.org/faq +Unreleased +---------- + +* Drop support for GHC 7. +* Drop flag `use-old-time` and support for `old-time`, require `time ≥ 1.5`. + 0.6.2.4 ------- diff --git a/hackage-security/hackage-security.cabal b/hackage-security/hackage-security.cabal index d1e8f15e..84ac45dd 100644 --- a/hackage-security/hackage-security.cabal +++ b/hackage-security/hackage-security.cabal @@ -42,7 +42,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 - GHC == 7.10.3 extra-source-files: ChangeLog.md @@ -110,16 +109,14 @@ library Hackage.Security.Util.Lens Hackage.Security.Util.Stack Hackage.Security.Util.TypedEmbedded - MyPrelude - -- We support ghc 7.4 (bundled with Cabal 1.14) and up - build-depends: base >= 4.8 && < 4.20, - -- PatternSynonyms are only available since GHC 7.8 (base 4.7) + + build-depends: base >= 4.9 && < 4.20, base16-bytestring >= 0.1.1 && < 1.1, base64-bytestring >= 1.0 && < 1.3, bytestring >= 0.9 && < 0.13, containers >= 0.4 && < 0.8, cryptohash-sha256 >= 0.11 && < 0.12, - directory >= 1.2 && < 1.4, + directory >= 1.2.2 && < 1.4, ed25519 >= 0.0 && < 0.1, filepath >= 1.2 && < 1.5, mtl >= 2.2 && < 2.4, @@ -129,7 +126,7 @@ library -- functionality, 0.5.0 changes type of serialise tar >= 0.5 && < 0.7, template-haskell >= 2.7 && < 2.22, - time >= 1.2 && < 1.13, + time >= 1.5 && < 1.13, transformers >= 0.3 && < 0.7, zlib >= 0.5 && < 0.7, -- whatever versions are bundled with ghc: @@ -175,18 +172,13 @@ library AllowAmbiguousTypes BangPatterns CPP + DeriveLift OverlappingInstances PackageImports RoleAnnotations StaticPointers UndecidableInstances - -- use the new stage1/cross-compile-friendly DeriveLift extension for GHC 8.0+ - if impl(ghc >= 8.0) - other-extensions: DeriveLift - else - other-extensions: TemplateHaskell - ghc-options: -Wall -- The URI type got split out off the network package after version 2.5, and diff --git a/hackage-security/src/Hackage/Security/Client.hs b/hackage-security/src/Hackage/Security/Client.hs index f8542556..bef41438 100644 --- a/hackage-security/src/Hackage/Security/Client.hs +++ b/hackage-security/src/Hackage/Security/Client.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE StaticPointers #-} -#endif + -- | Main entry point into the Hackage Security framework for clients module Hackage.Security.Client ( -- * Checking for updates @@ -41,7 +40,7 @@ module Hackage.Security.Client ( , LocalFileCorrupted(..) ) where -import MyPrelude hiding (log) +import Prelude hiding (log) import Control.Arrow (first) import Control.Exception import Control.Monad @@ -333,11 +332,7 @@ cachedVersion CachedInfo{..} remoteFile = -- | Get all cached info (if any) getCachedInfo :: -#if __GLASGOW_HASKELL__ < 800 - (Applicative m, MonadIO m) -#else MonadIO m -#endif => Repository down -> m CachedInfo getCachedInfo rep = do (cachedRoot, cachedKeyEnv) <- readLocalRoot rep @@ -360,9 +355,6 @@ readLocalRoot rep = do return (trustLocalFile signedRoot, rootKeys (signed signedRoot)) readLocalFile :: ( FromJSON ReadJSON_Keys_Layout (Signed a), MonadIO m -#if __GLASGOW_HASKELL__ < 800 - , Applicative m -#endif ) => Repository down -> KeyEnv -> CachedFile -> m (Maybe (Trusted a)) readLocalFile rep cachedKeyEnv file = do @@ -952,21 +944,12 @@ data InvalidFileInIndex = forall dec. InvalidFileInIndex { } deriving (Typeable) -#if MIN_VERSION_base(4,8,0) deriving instance Show InvalidPackageException deriving instance Show LocalFileCorrupted deriving instance Show InvalidFileInIndex instance Exception InvalidPackageException where displayException = pretty instance Exception LocalFileCorrupted where displayException = pretty instance Exception InvalidFileInIndex where displayException = pretty -#else -instance Show InvalidPackageException where show = pretty -instance Show LocalFileCorrupted where show = pretty -instance Show InvalidFileInIndex where show = pretty -instance Exception InvalidPackageException -instance Exception LocalFileCorrupted -instance Exception InvalidFileInIndex -#endif instance Pretty InvalidPackageException where pretty (InvalidPackageException pkgId) = "Invalid package " ++ display pkgId diff --git a/hackage-security/src/Hackage/Security/Client/Formats.hs b/hackage-security/src/Hackage/Security/Client/Formats.hs index 296aae78..58d5c0c3 100644 --- a/hackage-security/src/Hackage/Security/Client/Formats.hs +++ b/hackage-security/src/Hackage/Security/Client/Formats.hs @@ -17,7 +17,7 @@ module Hackage.Security.Client.Formats ( , formatsLookup ) where -import MyPrelude +import Prelude import Hackage.Security.Util.Stack import Hackage.Security.Util.TypedEmbedded diff --git a/hackage-security/src/Hackage/Security/Client/Repository.hs b/hackage-security/src/Hackage/Security/Client/Repository.hs index c516dac5..93dd76b0 100644 --- a/hackage-security/src/Hackage/Security/Client/Repository.hs +++ b/hackage-security/src/Hackage/Security/Client/Repository.hs @@ -30,7 +30,7 @@ module Hackage.Security.Client.Repository ( , mustCache ) where -import MyPrelude +import Prelude import Control.Exception import Data.Typeable (Typeable) import qualified Codec.Archive.Tar.Index as Tar @@ -385,13 +385,8 @@ data SomeRemoteError :: * where SomeRemoteError :: Exception e => e -> SomeRemoteError deriving (Typeable) -#if MIN_VERSION_base(4,8,0) deriving instance Show SomeRemoteError instance Exception SomeRemoteError where displayException = pretty -#else -instance Exception SomeRemoteError -instance Show SomeRemoteError where show = pretty -#endif instance Pretty SomeRemoteError where pretty (SomeRemoteError ex) = displayException ex diff --git a/hackage-security/src/Hackage/Security/Client/Repository/Cache.hs b/hackage-security/src/Hackage/Security/Client/Repository/Cache.hs index f1e99f64..4945b94b 100644 --- a/hackage-security/src/Hackage/Security/Client/Repository/Cache.hs +++ b/hackage-security/src/Hackage/Security/Client/Repository/Cache.hs @@ -15,7 +15,7 @@ module Hackage.Security.Client.Repository.Cache ( , lockCacheWithLogger ) where -import MyPrelude +import Prelude import Control.Exception import Control.Monad import Control.Monad.IO.Class diff --git a/hackage-security/src/Hackage/Security/Client/Repository/HttpLib.hs b/hackage-security/src/Hackage/Security/Client/Repository/HttpLib.hs index 29b6d406..6af1df02 100644 --- a/hackage-security/src/Hackage/Security/Client/Repository/HttpLib.hs +++ b/hackage-security/src/Hackage/Security/Client/Repository/HttpLib.hs @@ -11,7 +11,7 @@ module Hackage.Security.Client.Repository.HttpLib ( , bodyReaderFromBS ) where -import MyPrelude +import Prelude import Data.IORef import Network.URI hiding (uriPath, path) import qualified Data.ByteString as BS diff --git a/hackage-security/src/Hackage/Security/Client/Repository/Local.hs b/hackage-security/src/Hackage/Security/Client/Repository/Local.hs index fb014364..4f56f849 100644 --- a/hackage-security/src/Hackage/Security/Client/Repository/Local.hs +++ b/hackage-security/src/Hackage/Security/Client/Repository/Local.hs @@ -5,7 +5,7 @@ module Hackage.Security.Client.Repository.Local ( , withRepository ) where -import MyPrelude +import Prelude import Hackage.Security.Client.Formats import Hackage.Security.Client.Repository import Hackage.Security.Client.Repository.Cache diff --git a/hackage-security/src/Hackage/Security/Client/Repository/Remote.hs b/hackage-security/src/Hackage/Security/Client/Repository/Remote.hs index 1d601861..47640190 100644 --- a/hackage-security/src/Hackage/Security/Client/Repository/Remote.hs +++ b/hackage-security/src/Hackage/Security/Client/Repository/Remote.hs @@ -27,7 +27,7 @@ module Hackage.Security.Client.Repository.Remote ( , fileSizeWithinBounds ) where -import MyPrelude +import Prelude import Control.Concurrent import Control.Exception import Control.Monad (when, unless) @@ -498,13 +498,8 @@ instance Pretty FileTooLarge where expected (FileSizeExact n) = "exactly " ++ show n expected (FileSizeBound n) = "at most " ++ show n -#if MIN_VERSION_base(4,8,0) deriving instance Show FileTooLarge instance Exception FileTooLarge where displayException = pretty -#else -instance Exception FileTooLarge -instance Show FileTooLarge where show = pretty -#endif {------------------------------------------------------------------------------- Information about remote files @@ -687,4 +682,3 @@ verifyRemoteFile remoteTemp trustedInfo = do BS.L.take (fromIntegral deltaSeek) existing , temp ] - diff --git a/hackage-security/src/Hackage/Security/Client/Verify.hs b/hackage-security/src/Hackage/Security/Client/Verify.hs index eab0c653..28b8d5f9 100644 --- a/hackage-security/src/Hackage/Security/Client/Verify.hs +++ b/hackage-security/src/Hackage/Security/Client/Verify.hs @@ -10,7 +10,7 @@ module Hackage.Security.Client.Verify ( , liftIO ) where -import MyPrelude +import Prelude import Control.Exception import Control.Monad (join, void) import Control.Monad.IO.Class (MonadIO, liftIO) diff --git a/hackage-security/src/Hackage/Security/JSON.hs b/hackage-security/src/Hackage/Security/JSON.hs index 23d48d37..b4ab94c6 100644 --- a/hackage-security/src/Hackage/Security/JSON.hs +++ b/hackage-security/src/Hackage/Security/JSON.hs @@ -38,7 +38,7 @@ module Hackage.Security.JSON ( , module Hackage.Security.Util.JSON ) where -import MyPrelude +import Prelude import Control.Arrow (first, second) import Control.Exception import Control.Monad (unless, liftM) @@ -84,13 +84,8 @@ data DeserializationError = | DeserializationErrorFileType String String deriving (Typeable) -#if MIN_VERSION_base(4,8,0) deriving instance Show DeserializationError instance Exception DeserializationError where displayException = pretty -#else -instance Show DeserializationError where show = pretty -instance Exception DeserializationError -#endif instance Pretty DeserializationError where pretty (DeserializationErrorMalformed str) = diff --git a/hackage-security/src/Hackage/Security/Key.hs b/hackage-security/src/Hackage/Security/Key.hs index 81628812..db7cc383 100644 --- a/hackage-security/src/Hackage/Security/Key.hs +++ b/hackage-security/src/Hackage/Security/Key.hs @@ -25,7 +25,7 @@ module Hackage.Security.Key ( , verify ) where -import MyPrelude +import Prelude import Control.Monad import Data.Functor.Identity import Data.Typeable (Typeable) @@ -37,10 +37,6 @@ import qualified Data.ByteString.Char8 as BS.C8 import qualified Data.ByteString.Base16 as Base16 import qualified Data.ByteString.Lazy as BS.L -#if !MIN_VERSION_base(4,7,0) -import qualified Data.Typeable as Typeable -#endif - import Hackage.Security.Util.JSON import Hackage.Security.Util.Some import Hackage.Security.Util.TypedEmbedded @@ -277,26 +273,3 @@ instance ReportSchemaErrors m => FromJSON m (Some KeyType) where case tag of "ed25519" -> return . Some $ KeyTypeEd25519 _otherwise -> expected "valid key type" (Just tag) - -{------------------------------------------------------------------------------- - Orphans - - Pre-7.8 (base 4.7) we cannot have Typeable instance for higher-kinded types. - Instead, here we provide some instance for specific instantiations. --------------------------------------------------------------------------------} - -#if !MIN_VERSION_base(4,7,0) -tyConKey, tyConPublicKey, tyConPrivateKey :: Typeable.TyCon -tyConKey = Typeable.mkTyCon3 "hackage-security" "Hackage.Security.Key" "Key" -tyConPublicKey = Typeable.mkTyCon3 "hackage-security" "Hackage.Security.Key" "PublicKey" -tyConPrivateKey = Typeable.mkTyCon3 "hackage-security" "Hackage.Security.Key" "PrivateKey" - -instance Typeable (Some Key) where - typeOf _ = Typeable.mkTyConApp tyConSome [Typeable.mkTyConApp tyConKey []] - -instance Typeable (Some PublicKey) where - typeOf _ = Typeable.mkTyConApp tyConSome [Typeable.mkTyConApp tyConPublicKey []] - -instance Typeable (Some PrivateKey) where - typeOf _ = Typeable.mkTyConApp tyConSome [Typeable.mkTyConApp tyConPrivateKey []] -#endif diff --git a/hackage-security/src/Hackage/Security/Key/Env.hs b/hackage-security/src/Hackage/Security/Key/Env.hs index ca99062d..1d41953c 100644 --- a/hackage-security/src/Hackage/Security/Key/Env.hs +++ b/hackage-security/src/Hackage/Security/Key/Env.hs @@ -12,7 +12,7 @@ module Hackage.Security.Key.Env ( , union ) where -import MyPrelude hiding (lookup, null) +import Prelude hiding (lookup, null) import Control.Monad import Data.Map (Map) import qualified Data.Map as Map diff --git a/hackage-security/src/Hackage/Security/TUF/Common.hs b/hackage-security/src/Hackage/Security/TUF/Common.hs index d2f59fed..43a568c4 100644 --- a/hackage-security/src/Hackage/Security/TUF/Common.hs +++ b/hackage-security/src/Hackage/Security/TUF/Common.hs @@ -6,7 +6,7 @@ module Hackage.Security.TUF.Common ( , KeyThreshold(..) ) where -import MyPrelude +import Prelude import Hackage.Security.JSON {------------------------------------------------------------------------------- diff --git a/hackage-security/src/Hackage/Security/TUF/FileInfo.hs b/hackage-security/src/Hackage/Security/TUF/FileInfo.hs index de8235d0..354eaa74 100644 --- a/hackage-security/src/Hackage/Security/TUF/FileInfo.hs +++ b/hackage-security/src/Hackage/Security/TUF/FileInfo.hs @@ -13,7 +13,7 @@ module Hackage.Security.TUF.FileInfo ( , Int54 ) where -import MyPrelude hiding (lookup) +import Prelude hiding (lookup) import Data.Map (Map) import qualified Crypto.Hash.SHA256 as SHA256 import qualified Data.Map as Map diff --git a/hackage-security/src/Hackage/Security/TUF/FileMap.hs b/hackage-security/src/Hackage/Security/TUF/FileMap.hs index c57411e4..4d84189b 100644 --- a/hackage-security/src/Hackage/Security/TUF/FileMap.hs +++ b/hackage-security/src/Hackage/Security/TUF/FileMap.hs @@ -18,7 +18,7 @@ module Hackage.Security.TUF.FileMap ( , fileMapChanges ) where -import MyPrelude hiding (lookup) +import Prelude hiding (lookup) import Control.Arrow (second) import Data.Map (Map) import qualified Data.Map as Map diff --git a/hackage-security/src/Hackage/Security/TUF/Header.hs b/hackage-security/src/Hackage/Security/TUF/Header.hs index a1e8c86f..822c5c81 100644 --- a/hackage-security/src/Hackage/Security/TUF/Header.hs +++ b/hackage-security/src/Hackage/Security/TUF/Header.hs @@ -12,7 +12,7 @@ module Hackage.Security.TUF.Header ( , versionIncrement ) where -import MyPrelude +import Prelude import Data.Time import Data.Typeable (Typeable) diff --git a/hackage-security/src/Hackage/Security/TUF/Layout/Cache.hs b/hackage-security/src/Hackage/Security/TUF/Layout/Cache.hs index 6280ffc7..ba2baeae 100644 --- a/hackage-security/src/Hackage/Security/TUF/Layout/Cache.hs +++ b/hackage-security/src/Hackage/Security/TUF/Layout/Cache.hs @@ -4,7 +4,7 @@ module Hackage.Security.TUF.Layout.Cache ( , cabalCacheLayout ) where -import MyPrelude +import Prelude import Hackage.Security.TUF.Paths import Hackage.Security.Util.Path diff --git a/hackage-security/src/Hackage/Security/TUF/Layout/Index.hs b/hackage-security/src/Hackage/Security/TUF/Layout/Index.hs index e7cf0975..eaef6501 100644 --- a/hackage-security/src/Hackage/Security/TUF/Layout/Index.hs +++ b/hackage-security/src/Hackage/Security/TUF/Layout/Index.hs @@ -9,7 +9,7 @@ module Hackage.Security.TUF.Layout.Index ( , indexLayoutPkgPrefs ) where -import MyPrelude +import Prelude import Distribution.Package import Distribution.Text diff --git a/hackage-security/src/Hackage/Security/TUF/Layout/Repo.hs b/hackage-security/src/Hackage/Security/TUF/Layout/Repo.hs index da70c1ee..8df3bfae 100644 --- a/hackage-security/src/Hackage/Security/TUF/Layout/Repo.hs +++ b/hackage-security/src/Hackage/Security/TUF/Layout/Repo.hs @@ -5,7 +5,7 @@ module Hackage.Security.TUF.Layout.Repo ( , cabalLocalRepoLayout ) where -import MyPrelude +import Prelude import Distribution.Package import Distribution.Text diff --git a/hackage-security/src/Hackage/Security/TUF/Mirrors.hs b/hackage-security/src/Hackage/Security/TUF/Mirrors.hs index 0944bedb..bdba3377 100644 --- a/hackage-security/src/Hackage/Security/TUF/Mirrors.hs +++ b/hackage-security/src/Hackage/Security/TUF/Mirrors.hs @@ -9,7 +9,7 @@ module Hackage.Security.TUF.Mirrors ( , describeMirror ) where -import MyPrelude +import Prelude import Control.Monad.Except import Network.URI diff --git a/hackage-security/src/Hackage/Security/TUF/Paths.hs b/hackage-security/src/Hackage/Security/TUF/Paths.hs index 4a6f6a1c..5b2131c8 100644 --- a/hackage-security/src/Hackage/Security/TUF/Paths.hs +++ b/hackage-security/src/Hackage/Security/TUF/Paths.hs @@ -14,7 +14,7 @@ module Hackage.Security.TUF.Paths ( , anchorCachePath ) where -import MyPrelude +import Prelude import Hackage.Security.Util.Path import Hackage.Security.Util.Pretty diff --git a/hackage-security/src/Hackage/Security/TUF/Patterns.hs b/hackage-security/src/Hackage/Security/TUF/Patterns.hs index 01c6ac18..20bfb153 100644 --- a/hackage-security/src/Hackage/Security/TUF/Patterns.hs +++ b/hackage-security/src/Hackage/Security/TUF/Patterns.hs @@ -3,12 +3,9 @@ -- NOTE: This module was developed to prepare for proper delegation (#39). -- It is currently unused. {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DeriveLift #-} {-# LANGUAGE StandaloneDeriving #-} -#else -{-# LANGUAGE TemplateHaskell #-} -#endif + module Hackage.Security.TUF.Patterns ( -- * Patterns and replacements FileName @@ -26,7 +23,7 @@ module Hackage.Security.TUF.Patterns ( , qqd ) where -import MyPrelude +import Prelude import Control.Monad (guard) import Language.Haskell.TH (Q, Exp) import System.FilePath.Posix @@ -274,28 +271,9 @@ qqd pat repl = Left err -> fail $ "Invalid delegation: " ++ err Right del -> TH.lift del -#if __GLASGOW_HASKELL__ >= 800 deriving instance TH.Lift (Pattern a) deriving instance TH.Lift (Replacement a) deriving instance TH.Lift Delegation -#else -instance TH.Lift (Pattern a) where - lift (PatFileConst fn) = [| PatFileConst fn |] - lift (PatFileExt e) = [| PatFileExt e |] - lift PatFileAny = [| PatFileAny |] - lift (PatDirConst d p) = [| PatDirConst d p |] - lift (PatDirAny p) = [| PatDirAny p |] - -instance TH.Lift (Replacement a) where - lift (RepFileConst fn) = [| RepFileConst fn |] - lift (RepFileExt e ) = [| RepFileExt e |] - lift RepFileAny = [| RepFileAny |] - lift (RepDirConst d r) = [| RepDirConst d r |] - lift (RepDirAny r) = [| RepDirAny r |] - -instance TH.Lift Delegation where - lift (Delegation pat repl) = [| Delegation pat repl |] -#endif {------------------------------------------------------------------------------- JSON diff --git a/hackage-security/src/Hackage/Security/TUF/Root.hs b/hackage-security/src/Hackage/Security/TUF/Root.hs index 33a4a520..502ad6cf 100644 --- a/hackage-security/src/Hackage/Security/TUF/Root.hs +++ b/hackage-security/src/Hackage/Security/TUF/Root.hs @@ -6,7 +6,7 @@ module Hackage.Security.TUF.Root ( , RoleSpec(..) ) where -import MyPrelude +import Prelude import Hackage.Security.JSON import Hackage.Security.Key import Hackage.Security.Key.Env (KeyEnv) diff --git a/hackage-security/src/Hackage/Security/TUF/Signed.hs b/hackage-security/src/Hackage/Security/TUF/Signed.hs index 98fe963d..8b262230 100644 --- a/hackage-security/src/Hackage/Security/TUF/Signed.hs +++ b/hackage-security/src/Hackage/Security/TUF/Signed.hs @@ -27,7 +27,7 @@ module Hackage.Security.TUF.Signed ( , toPreSignatures ) where -import MyPrelude +import Prelude import Control.Monad import Data.Functor.Identity import qualified Data.ByteString as BS diff --git a/hackage-security/src/Hackage/Security/TUF/Snapshot.hs b/hackage-security/src/Hackage/Security/TUF/Snapshot.hs index 250dc920..4455d1b5 100644 --- a/hackage-security/src/Hackage/Security/TUF/Snapshot.hs +++ b/hackage-security/src/Hackage/Security/TUF/Snapshot.hs @@ -3,7 +3,7 @@ module Hackage.Security.TUF.Snapshot ( Snapshot(..) ) where -import MyPrelude +import Prelude import Control.Monad.Except import Control.Monad.Reader diff --git a/hackage-security/src/Hackage/Security/TUF/Targets.hs b/hackage-security/src/Hackage/Security/TUF/Targets.hs index e3585ad8..5db5ff62 100644 --- a/hackage-security/src/Hackage/Security/TUF/Targets.hs +++ b/hackage-security/src/Hackage/Security/TUF/Targets.hs @@ -8,7 +8,7 @@ module Hackage.Security.TUF.Targets ( , targetsLookup ) where -import MyPrelude +import Prelude import Hackage.Security.JSON import Hackage.Security.Key import Hackage.Security.Key.Env (KeyEnv) diff --git a/hackage-security/src/Hackage/Security/TUF/Timestamp.hs b/hackage-security/src/Hackage/Security/TUF/Timestamp.hs index 2a192539..574f57ed 100644 --- a/hackage-security/src/Hackage/Security/TUF/Timestamp.hs +++ b/hackage-security/src/Hackage/Security/TUF/Timestamp.hs @@ -3,7 +3,7 @@ module Hackage.Security.TUF.Timestamp ( Timestamp(..) ) where -import MyPrelude +import Prelude import Control.Monad.Except import Control.Monad.Reader diff --git a/hackage-security/src/Hackage/Security/Trusted.hs b/hackage-security/src/Hackage/Security/Trusted.hs index 7b797ee2..5931d992 100644 --- a/hackage-security/src/Hackage/Security/Trusted.hs +++ b/hackage-security/src/Hackage/Security/Trusted.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE StaticPointers #-} -#endif + module Hackage.Security.Trusted ( module Hackage.Security.Trusted.TCB -- * Derived functions @@ -12,7 +11,7 @@ module Hackage.Security.Trusted ( , trustedFileInfoEqual ) where -import MyPrelude +import Prelude import Data.Function (on) import Data.Time import Hackage.Security.TUF diff --git a/hackage-security/src/Hackage/Security/Trusted/TCB.hs b/hackage-security/src/Hackage/Security/Trusted/TCB.hs index 1e1baad8..eecd7712 100644 --- a/hackage-security/src/Hackage/Security/Trusted/TCB.hs +++ b/hackage-security/src/Hackage/Security/Trusted/TCB.hs @@ -16,17 +16,11 @@ module Hackage.Security.Trusted.TCB ( , signaturesVerified , verifyRole' , verifyFingerprints -#if __GLASGOW_HASKELL__ >= 710 -- * Re-exports , StaticPtr -#else - -- * Fake static pointers - , StaticPtr - , static -#endif ) where -import MyPrelude +import Prelude import Control.Exception import Control.Monad (when, unless) import Control.Monad.Except (Except, runExcept, throwError) @@ -38,17 +32,7 @@ import Hackage.Security.Key import Hackage.Security.Util.Pretty import qualified Hackage.Security.Util.Lens as Lens -#if __GLASGOW_HASKELL__ >= 710 import GHC.StaticPtr -#else --- Fake static pointers for ghc < 7.10. This means Trusted offers no --- additional type safety, but that's okay: we can still verify the code --- with ghc 7.10 and get the additional checks. -newtype StaticPtr a = StaticPtr { deRefStaticPtr :: a } - -static :: a -> StaticPtr a -static = StaticPtr -#endif -- | Trusted values -- @@ -209,17 +193,10 @@ data RootUpdated = RootUpdated type VerificationHistory = [Either RootUpdated VerificationError] -#if MIN_VERSION_base(4,8,0) deriving instance Show VerificationError deriving instance Show RootUpdated instance Exception VerificationError where displayException = pretty instance Exception RootUpdated where displayException = pretty -#else -instance Exception VerificationError -instance Show VerificationError where show = pretty -instance Show RootUpdated where show = pretty -instance Exception RootUpdated -#endif indentedLines :: [String] -> String indentedLines = unlines . map (" " ++) diff --git a/hackage-security/src/Hackage/Security/Util/Base64.hs b/hackage-security/src/Hackage/Security/Util/Base64.hs index 8cb44c2e..78a7a6b8 100644 --- a/hackage-security/src/Hackage/Security/Util/Base64.hs +++ b/hackage-security/src/Hackage/Security/Util/Base64.hs @@ -4,7 +4,7 @@ module Hackage.Security.Util.Base64 ( , toByteString ) where -import MyPrelude +import Prelude import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as C8 -- only called on B64-enc strings import qualified Data.ByteString.Base64 as B64 diff --git a/hackage-security/src/Hackage/Security/Util/Checked.hs b/hackage-security/src/Hackage/Security/Util/Checked.hs index b3671475..dcac49ba 100644 --- a/hackage-security/src/Hackage/Security/Util/Checked.hs +++ b/hackage-security/src/Hackage/Security/Util/Checked.hs @@ -1,15 +1,10 @@ {-# LANGUAGE CPP #-} -{-# OPTIONS_GHC -fno-warn-unused-binds #-} -#if __GLASGOW_HASKELL__ >= 800 -{-# OPTIONS_GHC -Wno-redundant-constraints #-} -#endif - -#if __GLASGOW_HASKELL__ >= 708 -{-# LANGUAGE RoleAnnotations #-} +{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE IncoherentInstances #-} -#endif +{-# LANGUAGE RoleAnnotations #-} -{-# LANGUAGE DeriveDataTypeable#-} +{-# OPTIONS_GHC -Wno-unused-binds #-} +{-# OPTIONS_GHC -Wno-redundant-constraints #-} -- | Checked exceptions module Hackage.Security.Util.Checked ( @@ -25,16 +20,12 @@ module Hackage.Security.Util.Checked ( , internalError ) where -import MyPrelude +import Prelude import Control.Exception (Exception, IOException) import qualified Control.Exception as Base import Data.Typeable (Typeable) -#if __GLASGOW_HASKELL__ >= 708 import GHC.Prim (coerce) -#else -import Unsafe.Coerce (unsafeCoerce) -#endif {------------------------------------------------------------------------------- Basic infrastructure @@ -43,9 +34,7 @@ import Unsafe.Coerce (unsafeCoerce) -- | Checked exceptions class Throws e where -#if __GLASGOW_HASKELL__ >= 708 type role Throws representational -#endif unthrow :: forall a e proxy . proxy e -> (Throws e => a) -> a unthrow _ x = unWrap (coerceWrap (Wrap x :: Wrap e a)) @@ -56,22 +45,10 @@ unthrow _ x = unWrap (coerceWrap (Wrap x :: Wrap e a)) -- | Determine if an exception is asynchronous, based on its type. isAsync :: Exception e => e -> Bool -#if MIN_VERSION_base(4, 7, 0) isAsync e = case Base.fromException $ Base.toException e of Just Base.SomeAsyncException{} -> True Nothing -> False -#else --- Earlier versions of GHC had no SomeAsyncException. We have to --- instead make up a list of async exceptions. -isAsync e = - let se = Base.toException e - in case () of - () - | Just (_ :: Base.AsyncException) <- Base.fromException se -> True - | show e == "<>" -> True - | otherwise -> False -#endif -- | 'Base.catch', but immediately rethrows asynchronous exceptions -- (as determined by 'isAsync'). @@ -131,11 +108,7 @@ internalError = throwUnchecked . userError newtype Wrap e a = Wrap { unWrap :: Throws e => a } coerceWrap :: Wrap e a -> Wrap (Catch e) a -#if __GLASGOW_HASKELL__ >= 708 coerceWrap = coerce -#else -coerceWrap = unsafeCoerce -#endif data Proxy a = Proxy diff --git a/hackage-security/src/Hackage/Security/Util/Exit.hs b/hackage-security/src/Hackage/Security/Util/Exit.hs index 374389c7..92808326 100644 --- a/hackage-security/src/Hackage/Security/Util/Exit.hs +++ b/hackage-security/src/Hackage/Security/Util/Exit.hs @@ -1,6 +1,6 @@ module Hackage.Security.Util.Exit where -import MyPrelude +import Prelude import Control.Monad (liftM) import Control.Monad.Except (ExceptT, runExceptT, throwError) diff --git a/hackage-security/src/Hackage/Security/Util/IO.hs b/hackage-security/src/Hackage/Security/Util/IO.hs index faf6e72d..02fa7fc8 100644 --- a/hackage-security/src/Hackage/Security/Util/IO.hs +++ b/hackage-security/src/Hackage/Security/Util/IO.hs @@ -9,7 +9,7 @@ module Hackage.Security.Util.IO ( , timedIO ) where -import MyPrelude +import Prelude import Control.Concurrent (threadDelay) import Control.Exception import Data.Time diff --git a/hackage-security/src/Hackage/Security/Util/JSON.hs b/hackage-security/src/Hackage/Security/Util/JSON.hs index 22720ea4..6dbd3d02 100644 --- a/hackage-security/src/Hackage/Security/Util/JSON.hs +++ b/hackage-security/src/Hackage/Security/Util/JSON.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ < 710 -{-# LANGUAGE OverlappingInstances #-} -#endif + -- | module Hackage.Security.Util.JSON ( -- * Type classes @@ -23,7 +21,7 @@ module Hackage.Security.Util.JSON ( , Int54 ) where -import MyPrelude +import Prelude import Control.Monad (liftM) import Data.Maybe (catMaybes) import Data.Map (Map) @@ -32,10 +30,6 @@ import Text.JSON.Canonical import Network.URI import qualified Data.Map as Map -#if !MIN_VERSION_time(1,5,0) -import System.Locale (defaultTimeLocale) -#endif - import Hackage.Security.Util.Path {------------------------------------------------------------------------------- @@ -120,16 +114,12 @@ instance ReportSchemaErrors m => FromJSON m Int54 where fromJSON val = expected' "int" val instance -#if __GLASGOW_HASKELL__ >= 710 {-# OVERLAPPABLE #-} -#endif (Monad m, ToJSON m a) => ToJSON m [a] where toJSON = liftM JSArray . mapM toJSON instance -#if __GLASGOW_HASKELL__ >= 710 {-# OVERLAPPABLE #-} -#endif (ReportSchemaErrors m, FromJSON m a) => FromJSON m [a] where fromJSON (JSArray as) = mapM fromJSON as fromJSON val = expected' "array" val @@ -143,10 +133,6 @@ instance ReportSchemaErrors m => FromJSON m UTCTime where case parseTimeM False defaultTimeLocale "%FT%TZ" str of Just time -> return time Nothing -> expected "valid date-time string" (Just str) -#if !MIN_VERSION_time(1,5,0) - where - parseTimeM _trim = parseTime -#endif instance ( Monad m , ToObjectKey m k diff --git a/hackage-security/src/Hackage/Security/Util/Lens.hs b/hackage-security/src/Hackage/Security/Util/Lens.hs index 4def266e..c468dac6 100644 --- a/hackage-security/src/Hackage/Security/Util/Lens.hs +++ b/hackage-security/src/Hackage/Security/Util/Lens.hs @@ -14,7 +14,7 @@ module Hackage.Security.Util.Lens ( , set ) where -import MyPrelude +import Prelude import Control.Applicative import Data.Functor.Identity diff --git a/hackage-security/src/Hackage/Security/Util/Path.hs b/hackage-security/src/Hackage/Security/Util/Path.hs index 0cd14dfa..00a115e1 100644 --- a/hackage-security/src/Hackage/Security/Util/Path.hs +++ b/hackage-security/src/Hackage/Security/Util/Path.hs @@ -83,16 +83,12 @@ module Hackage.Security.Util.Path ( , IO.hSeek ) where -import MyPrelude +import Prelude import Control.Monad import Data.List (isPrefixOf) import System.IO (IOMode(..), BufferMode(..), Handle, SeekMode(..)) import System.IO.Unsafe (unsafeInterleaveIO) -#if MIN_VERSION_directory(1,2,0) import Data.Time (UTCTime) -#else -import System.Time (ClockTime) -#endif import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BS.L import qualified System.FilePath as FP.Native @@ -239,21 +235,7 @@ class FsRoot root where toAbsoluteFilePath :: Path root -> IO FilePath instance FsRoot Relative where - toAbsoluteFilePath p = go (unPathNative p) - where - go :: FilePath -> IO FilePath -#if MIN_VERSION_directory(1,2,2) - go = Dir.makeAbsolute -#else - -- copied implementation from the directory package - go = (FP.Native.normalise <$>) . absolutize - absolutize path -- avoid the call to `getCurrentDirectory` if we can - | FP.Native.isRelative path - = (FP.Native. path) - . FP.Native.addTrailingPathSeparator <$> - Dir.getCurrentDirectory - | otherwise = return path -#endif + toAbsoluteFilePath p = Dir.makeAbsolute (unPathNative p) instance FsRoot Absolute where toAbsoluteFilePath = return . unPathNative @@ -371,11 +353,7 @@ doesDirectoryExist path = do filePath <- toAbsoluteFilePath path Dir.doesDirectoryExist filePath -#if MIN_VERSION_directory(1,2,0) getModificationTime :: FsRoot root => Path root -> IO UTCTime -#else -getModificationTime :: FsRoot root => Path root -> IO ClockTime -#endif getModificationTime path = do filePath <- toAbsoluteFilePath path Dir.getModificationTime filePath diff --git a/hackage-security/src/Hackage/Security/Util/Pretty.hs b/hackage-security/src/Hackage/Security/Util/Pretty.hs index 5505ba58..bc185510 100644 --- a/hackage-security/src/Hackage/Security/Util/Pretty.hs +++ b/hackage-security/src/Hackage/Security/Util/Pretty.hs @@ -3,7 +3,7 @@ module Hackage.Security.Util.Pretty ( Pretty(..) ) where -import MyPrelude +import Prelude -- | Produce a human-readable string class Pretty a where diff --git a/hackage-security/src/Hackage/Security/Util/Some.hs b/hackage-security/src/Hackage/Security/Util/Some.hs index d1ee7893..e36fa4f8 100644 --- a/hackage-security/src/Hackage/Security/Util/Some.hs +++ b/hackage-security/src/Hackage/Security/Util/Some.hs @@ -13,30 +13,17 @@ module Hackage.Security.Util.Some ( , SomePretty(..) -- ** Type checking , typecheckSome -#if !MIN_VERSION_base(4,7,0) - -- ** Compatibility with base < 4.7 - , tyConSome -#endif ) where -import MyPrelude -#if MIN_VERSION_base(4,7,0) +import Prelude import Data.Typeable (Typeable) -#else -import qualified Data.Typeable as Typeable -#endif import Hackage.Security.Util.TypedEmbedded import Hackage.Security.Util.Pretty data Some f = forall a. Some (f a) -#if MIN_VERSION_base(4,7,0) deriving instance Typeable Some -#else -tyConSome :: Typeable.TyCon -tyConSome = Typeable.mkTyCon3 "hackage-security" "Hackage.Security.Util.Some" "Some" -#endif {------------------------------------------------------------------------------- Equality on Some types diff --git a/hackage-security/src/Hackage/Security/Util/Stack.hs b/hackage-security/src/Hackage/Security/Util/Stack.hs index 6c3446d6..8d643f6d 100644 --- a/hackage-security/src/Hackage/Security/Util/Stack.hs +++ b/hackage-security/src/Hackage/Security/Util/Stack.hs @@ -3,7 +3,7 @@ module Hackage.Security.Util.Stack ( (:-)(..) ) where -import MyPrelude +import Prelude data h :- t = h :- t deriving (Eq, Show) diff --git a/hackage-security/src/Hackage/Security/Util/TypedEmbedded.hs b/hackage-security/src/Hackage/Security/Util/TypedEmbedded.hs index 4bdb356d..bbdca6a5 100644 --- a/hackage-security/src/Hackage/Security/Util/TypedEmbedded.hs +++ b/hackage-security/src/Hackage/Security/Util/TypedEmbedded.hs @@ -7,7 +7,7 @@ module Hackage.Security.Util.TypedEmbedded ( , AsType(..) ) where -import MyPrelude +import Prelude -- | Type equality proofs -- diff --git a/hackage-security/src/MyPrelude.hs b/hackage-security/src/MyPrelude.hs deleted file mode 100644 index 7e4ef99b..00000000 --- a/hackage-security/src/MyPrelude.hs +++ /dev/null @@ -1,31 +0,0 @@ --- | Smooth over differences between various ghc versions by making older --- preludes look like 4.8.0 -{-# LANGUAGE CPP #-} -module MyPrelude ( - module P -#if !MIN_VERSION_base(4,8,0) - , Applicative(..) - , Monoid(..) - , (<$>) - , (<$) - , Traversable(traverse) - , displayException -#endif - ) where - -#if MIN_VERSION_base(4,8,0) -import Prelude as P -#else -#if MIN_VERSION_base(4,6,0) -import Prelude as P -#else -import Prelude as P hiding (catch) -#endif -import Control.Applicative -import Control.Exception (Exception) -import Data.Monoid -import Data.Traversable (Traversable(traverse)) - -displayException :: Exception e => e -> String -displayException = show -#endif diff --git a/hackage-security/src/Text/JSON/Canonical.hs b/hackage-security/src/Text/JSON/Canonical.hs index 9c05663c..3166bb85 100644 --- a/hackage-security/src/Text/JSON/Canonical.hs +++ b/hackage-security/src/Text/JSON/Canonical.hs @@ -30,21 +30,16 @@ module Text.JSON.Canonical , prettyCanonicalJSON ) where -import MyPrelude +import Prelude import Text.ParserCombinators.Parsec ( CharParser, (<|>), (), many, between, sepBy , satisfy, char, string, digit, spaces , parse ) import Text.PrettyPrint hiding (char) import qualified Text.PrettyPrint as Doc -#if !(MIN_VERSION_base(4,7,0)) -import Control.Applicative ((<$>), (<$), pure, (<*>), (<*), (*>)) -#endif import Control.Arrow (first) import Data.Bits (Bits) -#if MIN_VERSION_base(4,7,0) import Data.Bits (FiniteBits) -#endif import Data.Char (isDigit, digitToInt) import Data.Data (Data) import Data.Function (on) @@ -83,9 +78,7 @@ newtype Int54 = Int54 { int54ToInt64 :: Int64 } , Ord , Real , Ix -#if MIN_VERSION_base(4,7,0) , FiniteBits -#endif , Bits , Storable , PrintfArg @@ -353,4 +346,3 @@ punctuate' l p r (x:xs) = l <+> x : go xs go [] = [] go [y] = [p <+> y, r] go (y:ys) = (p <+> y) : go ys - diff --git a/precompute-fileinfo/precompute-fileinfo.cabal b/precompute-fileinfo/precompute-fileinfo.cabal index e36691e0..ad0432d6 100644 --- a/precompute-fileinfo/precompute-fileinfo.cabal +++ b/precompute-fileinfo/precompute-fileinfo.cabal @@ -16,12 +16,11 @@ cabal-version: >=1.10 tested-with: GHC==9.6.3, GHC==9.4.5, GHC==9.2.8, GHC==9.0.2, - GHC==8.10.7, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, - GHC==7.10.3 + GHC==8.10.7, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2 executable precompute-fileinfo main-is: Main.hs - build-depends: base >= 4.4, + build-depends: base >= 4.9, bytestring >= 0.9, containers >= 0.4, deepseq >= 1.3,