From cf3789658535fb23ca4d5b8e5da97d07f20e155a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Sep 2025 07:42:15 +0200 Subject: [PATCH 1/3] No longer derive Typeable (obsolete since GHC 7.10) --- src/Network/NetRc.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Network/NetRc.hs b/src/Network/NetRc.hs index 7b68a0b..acfdb5f 100644 --- a/src/Network/NetRc.hs +++ b/src/Network/NetRc.hs @@ -72,7 +72,7 @@ data NetRcHost = NetRcHost , nrhPassword :: !ByteString -- ^ @password@ property (@""@ if missing) , nrhAccount :: !ByteString -- ^ @account@ property (@""@ if missing) , nrhMacros :: [NetRcMacDef] -- ^ associated @macdef@ entries - } deriving (Eq,Ord,Show,Typeable,Data,Generic) + } deriving (Eq, Ord, Show, Data, Generic) instance NFData NetRcHost where rnf !_ = () @@ -84,7 +84,7 @@ data NetRcMacDef = NetRcMacDef , nrmBody :: !ByteString -- ^ Raw @macdef@ body -- -- __Invariant__: must not contain null-lines, i.e. consecutive @LF@s - } deriving (Eq,Ord,Show,Typeable,Data,Generic) + } deriving (Eq, Ord, Show, Data, Generic) instance NFData NetRcMacDef where rnf !_ = () @@ -105,7 +105,7 @@ data NetRc = NetRc -- associated with host-entries are -- invisible to some applications -- (e.g. @ftp(1)@). - } deriving (Eq,Ord,Show,Typeable,Data,Generic) + } deriving (Eq, Ord, Show, Data, Generic) instance NFData NetRc where rnf (NetRc ms ds) = ms `deepseq` ds `deepseq` () From 72623e185f08a59cefd7eb1bc5bfbcd948b4244a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Sep 2025 07:42:47 +0200 Subject: [PATCH 2/3] Update conditional code (`#if`) * Remove conditional code obsolete with GHC >= 8 * Fix import warning for foldl' --- src/Network/NetRc.hs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Network/NetRc.hs b/src/Network/NetRc.hs index acfdb5f..5a63f67 100644 --- a/src/Network/NetRc.hs +++ b/src/Network/NetRc.hs @@ -55,8 +55,13 @@ import qualified Data.ByteString.Char8 as BC import qualified Data.ByteString.Lazy as LB import Data.Data import Data.Either (rights, lefts) -import Data.List (intersperse, foldl') -import Data.Monoid +import Data.List (intersperse) +#if !MIN_VERSION_base(4,20,0) +import Data.List (foldl') +#endif +#if !MIN_VERSION_base(4,11,0) +import Data.Semigroup ((<>)) +#endif import GHC.Generics import System.Environment import System.IO.Error @@ -142,12 +147,7 @@ netRcToBuilder (NetRc ms ds) = -- -- This is currently just a convenience wrapper around 'netRcToBuilder' netRcToByteString :: NetRc -> ByteString -#if MIN_VERSION_bytestring(0,10,0) netRcToByteString = LB.toStrict . BB.toLazyByteString . netRcToBuilder -#else -netRcToByteString = B.concat . LB.toChunks . BB.toLazyByteString . netRcToBuilder -#endif - -- | Convenience wrapper for 'netRcParsec' parser -- @@ -163,7 +163,6 @@ netRcToByteString = B.concat . LB.toChunks . BB.toLazyByteString . netRcToBuilde parseNetRc :: P.SourceName -> ByteString -> Either P.ParseError NetRc parseNetRc = P.parse (netRcParsec <* P.eof) - -- | Reads and parses default @$HOME/.netrc@ -- -- Returns 'Nothing' if @$HOME@ variable undefined and/or if @.netrc@ if missing. @@ -184,10 +183,6 @@ readUserNetRc = do Left e | isDoesNotExistError e -> return Nothing | otherwise -> ioError e Right b -> return $! Just $! parseNetRc fn b -#if !(MIN_VERSION_base(4,6,0)) - where - lookupEnv k = lookup k <$> getEnvironment -#endif -- | "Text.Parsec.ByteString" 'P.Parser' for @.netrc@ grammar netRcParsec :: P.Parser NetRc From a0b5cc3f84df67794eddcf02634c78c4eac67b2c Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Sep 2025 07:50:33 +0200 Subject: [PATCH 3/3] Bump to 0.2.0.2 and CHANGELOG; bump Haskell CI to GHC 9.14 alpha1 --- .github/workflows/haskell-ci.yml | 51 ++++++++++++++++++++++++++++---- changelog.md | 9 ++++++ netrc.cabal | 20 ++++++++----- src-tests/test-netrc.hs | 4 +-- 4 files changed, 68 insertions(+), 16 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 066096c..2980e38 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20250506 +# version: 0.19.20250821 # -# REGENDATA ("0.19.20250506",["github","netrc.cabal"]) +# REGENDATA ("0.19.20250821",["github","netrc.cabal"]) # name: Haskell-CI on: @@ -32,6 +32,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.14.0.20250819 + compilerKind: ghc + compilerVersion: 9.14.0.20250819 + setup-method: ghcup-prerelease + allow-failure: false - compiler: ghc-9.12.2 compilerKind: ghc compilerVersion: 9.12.2 @@ -110,8 +115,8 @@ jobs: chmod a+x "$HOME/.ghcup/bin/ghcup" - name: Install cabal-install run: | - "$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + "$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" - name: Install GHC (GHCup) if: matrix.setup-method == 'ghcup' run: | @@ -126,6 +131,21 @@ jobs: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} HCVER: ${{ matrix.compilerVersion }} + - name: Install GHC (GHCup prerelease) + if: matrix.setup-method == 'ghcup-prerelease' + run: | + "$HOME/.ghcup/bin/ghcup" config add-release-channel prereleases + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + 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" + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH @@ -136,7 +156,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 91400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} @@ -164,6 +184,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package netrc" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package netrc" >> cabal.project ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package netrc" >> cabal.project ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi cat >> cabal.project <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(netrc)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local diff --git a/changelog.md b/changelog.md index 3c4380d..0244b40 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,12 @@ +## 0.2.0.2 + +_Andreas Abel, 2025-09-02_ + + - Remove obsolete `deriving Typeable`. + - Remove old code for GHC 7. + - Fix warnings. + - Tested with GHC 8.0 - 9.14 alpha1. + ## 0.2.0.1 _Andreas Abel, 2024-06-25_ diff --git a/netrc.cabal b/netrc.cabal index 6ca2a42..dc6bf47 100644 --- a/netrc.cabal +++ b/netrc.cabal @@ -1,6 +1,6 @@ -cabal-version: >=1.10 +cabal-version: 1.18 name: netrc -version: 0.2.0.1 +version: 0.2.0.2 synopsis: Parser for .netrc files homepage: https://github.com/haskell-hvr/netrc bug-reports: https://github.com/haskell-hvr/netrc/issues @@ -19,6 +19,7 @@ description: tested-with: + GHC == 9.14.1 GHC == 9.12.2 GHC == 9.10.2 GHC == 9.8.4 @@ -33,8 +34,10 @@ tested-with: GHC == 8.2.2 GHC == 8.0.2 -extra-source-files: +extra-doc-files: changelog.md + +extra-source-files: src-tests/data/*.netrc src-tests/data/*.netrc.out @@ -48,11 +51,12 @@ library OverloadedStrings RecordWildCards + -- Lower bounds taken from GHC 8.0 and Stackage LTS 7.0 build-depends: base >= 4.9 && < 5 - , deepseq >= 1.3 && < 1.6 - , bytestring >= 0.10.4 && < 0.13 - , parsec >= 3.1 && < 3.2 + , deepseq >= 1.4.2.0 && < 1.6 + , bytestring >= 0.10.8.0 && < 0.13 + , parsec >= 3.1.11 && < 3.2 hs-source-dirs: src exposed-modules: Network.NetRc @@ -71,9 +75,9 @@ test-suite test-netrc netrc , base , bytestring - , tasty >= 0.10 && < 1.6 + , tasty >= 0.11.0.4 && < 1.6 , tasty-golden == 2.3.* - , tasty-quickcheck >= 0.8.1 && < 1 + , tasty-quickcheck >= 0.8.4 && < 1 source-repository head type: git diff --git a/src-tests/test-netrc.hs b/src-tests/test-netrc.hs index 79db4a5..e81e0ef 100644 --- a/src-tests/test-netrc.hs +++ b/src-tests/test-netrc.hs @@ -39,13 +39,13 @@ main = do let goTests = testGroup "ref-samples" [ goldenVsString tn (fp++".out") (doGoTest fp) | fp <- sort netrcFiles - , let Just tn = stripPrefix "src-tests/data/" fp + , let tn = fromMaybe undefined $ stripPrefix "src-tests/data/" fp ] let goTests2 = testGroup "ref-samples2" [ goldenVsString tn (fp++".out2") (doGoTest2 fp) | fp <- sort netrcFiles - , let Just tn = stripPrefix "src-tests/data/" fp + , let tn = fromMaybe undefined $ stripPrefix "src-tests/data/" fp ] defaultMain $ testGroup "Tests" [goTests, goTests2, qcTests]