From 4359275937305141cbb830bd8e7d6ea914785882 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 16 Apr 2022 09:18:00 +0200 Subject: [PATCH 1/8] Activate Github workflows by vanilla CI --- .github/workflows/haskell.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/haskell.yml diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml new file mode 100644 index 0000000..25f7fa6 --- /dev/null +++ b/.github/workflows/haskell.yml @@ -0,0 +1,43 @@ +name: Haskell CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-haskell@v1 + with: + ghc-version: '8.10.3' + cabal-version: '3.2' + + - name: Cache + uses: actions/cache@v3 + env: + cache-name: cache-cabal + with: + path: ~/.cabal + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install dependencies + run: | + cabal update + cabal build --only-dependencies --enable-tests --enable-benchmarks + - name: Build + run: cabal build --enable-tests --enable-benchmarks all + - name: Run tests + run: cabal test all From 8c06066ba1a9ecedd34e14bb912c713dc4455d8c Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 16 Apr 2022 09:09:37 +0200 Subject: [PATCH 2/8] Switch cabal-version to 1.10 (to satisfy cabal check) --- ini.cabal | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ini.cabal b/ini.cabal index 8933c3e..1b8ed3e 100644 --- a/ini.cabal +++ b/ini.cabal @@ -1,6 +1,7 @@ +cabal-version: >= 1.10 name: ini -version: 0.4.2 -synopsis: Quick and easy configuration files in the INI format. +version: 0.4.2.20220416 +synopsis: Configuration files in the INI format. description: Quick and easy configuration files in the INI format. license: BSD3 license-file: LICENSE @@ -11,12 +12,9 @@ bug-reports: http://github.com/chrisdone/ini/issues copyright: 2013 Chris Done category: Data, Configuration build-type: Simple -cabal-version: >=1.8 library hs-source-dirs: src/ - ghc-options: -Wall -O2 - extensions: OverloadedStrings exposed-modules: Data.Ini build-depends: base >= 4 && <5, attoparsec, @@ -25,6 +23,11 @@ library if !impl(ghc >= 8) build-depends: semigroups >= 0.10 && < 0.19 + default-language: Haskell98 + default-extensions: OverloadedStrings + + ghc-options: -Wall + test-suite ini-test type: exitcode-stdio-1.0 hs-source-dirs: test @@ -34,6 +37,8 @@ test-suite ini-test , hspec , unordered-containers + default-language: Haskell98 + source-repository head type: git location: http://github.com/chrisdone/ini.git From 8fbf97e4f5d8606411d2e2ba076de1bdfa37aa65 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 16 Apr 2022 09:14:57 +0200 Subject: [PATCH 3/8] Silence warning about non-canonical mappend --- src/Data/Ini.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Ini.hs b/src/Data/Ini.hs index f08e71d..f3201c7 100644 --- a/src/Data/Ini.hs +++ b/src/Data/Ini.hs @@ -90,12 +90,12 @@ data Ini = deriving (Show, Eq) instance Semigroup Ini where - (<>) = mappend + x <> y = Ini {iniGlobals = mempty, iniSections = iniSections x <> iniSections y} instance Monoid Ini where mempty = Ini {iniGlobals = mempty, iniSections = mempty} - mappend x y = - Ini {iniGlobals = mempty, iniSections = iniSections x <> iniSections y} + mappend = (<>) + {-# DEPRECATED #-} unIni :: Ini -> HashMap Text (HashMap Text Text) From 0891702a930bc11595f1868a12430ef42d84b0ac Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 16 Apr 2022 09:15:20 +0200 Subject: [PATCH 4/8] Haskell-CI on github action for GHC 7.0 - 9.2 --- .github/workflows/haskell-ci.yml | 267 +++++++++++++++++++++++++++++++ ini.cabal | 18 ++- 2 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/haskell-ci.yml diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml new file mode 100644 index 0000000..61c7a66 --- /dev/null +++ b/.github/workflows/haskell-ci.yml @@ -0,0 +1,267 @@ +# This GitHub workflow config has been generated by a script via +# +# haskell-ci 'github' 'ini.cabal' +# +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# +# For more information, see https://github.com/haskell-CI/haskell-ci +# +# version: 0.14.3.20220416 +# +# REGENDATA ("0.14.3.20220416",["github","ini.cabal"]) +# +name: Haskell-CI +on: + - push + - pull_request +jobs: + linux: + name: Haskell-CI - Linux - ${{ matrix.compiler }} + runs-on: ubuntu-18.04 + timeout-minutes: + 60 + container: + image: buildpack-deps:bionic + continue-on-error: ${{ matrix.allow-failure }} + strategy: + matrix: + include: + - compiler: ghc-9.2.2 + compilerKind: ghc + compilerVersion: 9.2.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.0.2 + compilerKind: ghc + compilerVersion: 9.0.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-8.10.7 + compilerKind: ghc + compilerVersion: 8.10.7 + setup-method: ghcup + allow-failure: false + - compiler: ghc-8.8.4 + compilerKind: ghc + compilerVersion: 8.8.4 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.6.5 + compilerKind: ghc + compilerVersion: 8.6.5 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.4.4 + compilerKind: ghc + compilerVersion: 8.4.4 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.2.2 + compilerKind: ghc + compilerVersion: 8.2.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-8.0.2 + compilerKind: ghc + compilerVersion: 8.0.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.10.3 + compilerKind: ghc + compilerVersion: 7.10.3 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.8.4 + compilerKind: ghc + compilerVersion: 7.8.4 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.6.3 + compilerKind: ghc + compilerVersion: 7.6.3 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.4.2 + compilerKind: ghc + compilerVersion: 7.4.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.2.2 + compilerKind: ghc + compilerVersion: 7.2.2 + setup-method: hvr-ppa + allow-failure: false + - compiler: ghc-7.0.4 + compilerKind: ghc + compilerVersion: 7.0.4 + 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 + if [ "${{ matrix.setup-method }}" = ghcup ]; then + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + 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.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + fi + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: Set PATH and environment variables + run: | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" + 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/$HCKIND-$HCVER + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" + echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.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.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + fi + + 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" + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" + echo "GHCJSARITH=0" >> "$GITHUB_ENV" + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: env + run: | + env + - name: write cabal config + run: | + mkdir -p $CABAL_DIR + cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz + echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan + rm -f cabal-plan.xz + chmod a+x $HOME/.cabal/bin/cabal-plan + cabal-plan --version + - name: checkout + uses: actions/checkout@v2 + with: + path: source + - name: initial cabal.project for sdist + run: | + touch cabal.project + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project + cat cabal.project + - name: sdist + run: | + mkdir -p sdist + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist + - name: unpack + run: | + mkdir -p unpacked + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; + - name: generate cabal.project + run: | + PKGDIR_ini="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/ini-[0-9.]*')" + echo "PKGDIR_ini=${PKGDIR_ini}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local + touch cabal.project + touch cabal.project.local + echo "packages: ${PKGDIR_ini}" >> cabal.project + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package ini" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + cat >> cabal.project <> cabal.project.local + cat cabal.project + cat cabal.project.local + - name: dump install plan + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + cabal-plan + - name: cache + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- + - name: install dependencies + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all + - name: build w/o tests + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: build + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always + - name: tests + run: | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + - name: cabal check + run: | + cd ${PKGDIR_ini} || false + ${CABAL} -vnormal check + - name: haddock + run: | + $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + - name: unconstrained build + run: | + rm -f cabal.project.local + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all diff --git a/ini.cabal b/ini.cabal index 1b8ed3e..281c323 100644 --- a/ini.cabal +++ b/ini.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: ini -version: 0.4.2.20220416 +version: 0.4.2.1 synopsis: Configuration files in the INI format. description: Quick and easy configuration files in the INI format. license: BSD3 @@ -13,6 +13,22 @@ copyright: 2013 Chris Done category: Data, Configuration build-type: Simple +tested-with: + GHC == 9.2.2 + 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 == 7.8.4 + GHC == 7.6.3 + GHC == 7.4.2 + GHC == 7.2.2 + GHC == 7.0.4 + library hs-source-dirs: src/ exposed-modules: Data.Ini From 5939aa61238d8b43262516d714b98cefd09f9059 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Mon, 25 Jul 2022 23:44:37 +0200 Subject: [PATCH 5/8] ini.cabal: new maintainer, TypeOperators, tested-with GHC 9.4.1 --- .github/workflows/haskell-ci.yml | 53 +++++++++++++++++++++++--------- .gitignore | 1 + cabal.haskell-ci | 1 + ini.cabal | 14 ++++++--- 4 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 cabal.haskell-ci diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 61c7a66..6798e15 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,18 +8,22 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.14.3.20220416 +# version: 0.15.20220710 # -# REGENDATA ("0.14.3.20220416",["github","ini.cabal"]) +# REGENDATA ("0.15.20220710",["github","ini.cabal"]) # name: Haskell-CI on: - - push - - pull_request + push: + branches: + - master + pull_request: + branches: + - master jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 timeout-minutes: 60 container: @@ -28,9 +32,14 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.2.2 + - compiler: ghc-9.4.0.20220623 compilerKind: ghc - compilerVersion: 9.2.2 + compilerVersion: 9.4.0.20220623 + setup-method: ghcup + allow-failure: true + - compiler: ghc-9.2.3 + compilerKind: ghc + compilerVersion: 9.2.3 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -106,18 +115,19 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.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.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -148,7 +158,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 >= 90400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -177,6 +187,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(ini)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -260,7 +285,7 @@ jobs: ${CABAL} -vnormal check - name: haddock run: | - $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all - name: unconstrained build run: | rm -f cabal.project.local diff --git a/.gitignore b/.gitignore index 40a8312..b7239ff 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ tags .cabal-sandbox/ cabal.sandbox.config .stack-work/ +/dist-newstyle/ diff --git a/cabal.haskell-ci b/cabal.haskell-ci new file mode 100644 index 0000000..e1f1b77 --- /dev/null +++ b/cabal.haskell-ci @@ -0,0 +1 @@ +branches: master diff --git a/ini.cabal b/ini.cabal index 281c323..8939f9d 100644 --- a/ini.cabal +++ b/ini.cabal @@ -6,15 +6,16 @@ description: Quick and easy configuration files in the INI format. license: BSD3 license-file: LICENSE author: Chris Done -maintainer: chrisdone@gmail.com -homepage: http://github.com/chrisdone/ini -bug-reports: http://github.com/chrisdone/ini/issues +maintainer: Andreas Abel +homepage: https://github.com/andreasabel/ini +bug-reports: https://github.com/andreasabel/ini/issues copyright: 2013 Chris Done category: Data, Configuration build-type: Simple tested-with: - GHC == 9.2.2 + GHC == 9.4.1 + GHC == 9.2.3 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 @@ -41,8 +42,11 @@ library default-language: Haskell98 default-extensions: OverloadedStrings + TypeOperators ghc-options: -Wall + if impl(ghc >= 8) + ghc-options: -Wcompat test-suite ini-test type: exitcode-stdio-1.0 @@ -57,4 +61,4 @@ test-suite ini-test source-repository head type: git - location: http://github.com/chrisdone/ini.git + location: https://github.com/andreasabel/ini.git From dabb2ec567eca7da6ac00d826450a0c9069cf232 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 26 Jul 2022 00:42:17 +0200 Subject: [PATCH 6/8] Release 0.4.2: CHANGELOG, README badges, allow latest semigroup --- CHANGELOG.md | 14 ++++++++++++++ README.md | 9 +++++++-- ini.cabal | 8 ++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f3b4aa4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +## 0.4.2 + +_2022-07-26, Andreas Abel_ + +- Fail parsing if the input is not completely consumed [#30](https://github.com/chrisdone/ini/pull/30) +- Print global values as well [#28](https://github.com/chrisdone/ini/pull/28) + +Tested with GHC 7.0 - 9.4.1 RC1. + +## 0.4.1 + +_2019-01-02, Chris Done_ + +- Allow global section [#6](https://github.com/chrisdone/ini/issues/6) diff --git a/README.md b/README.md index 09d71d7..b40db79 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ -ini [![Hackage](https://img.shields.io/hackage/v/ini.svg?style=flat)](https://hackage.haskell.org/package/ini) -===== +[![Hackage](https://img.shields.io/hackage/v/ini.svg?color=informational)](https://hackage.haskell.org/package/ini) +[![ini on Stackage Nightly](https://stackage.org/package/ini/badge/nightly)](https://stackage.org/nightly/package/ini) +[![Stackage LTS version](https://www.stackage.org/package/ini/badge/lts?label=Stackage)](https://www.stackage.org/package/ini) +[![Haskell CI](https://github.com/andreasabel/ini/actions/workflows/haskell.yml/badge.svg)](https://github.com/andreasabel/ini/actions/workflows/haskell.yml) + +ini +=== Quick and easy configuration files in the INI format for Haskell. diff --git a/ini.cabal b/ini.cabal index 8939f9d..0451fcd 100644 --- a/ini.cabal +++ b/ini.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: ini -version: 0.4.2.1 +version: 0.4.2 synopsis: Configuration files in the INI format. description: Quick and easy configuration files in the INI format. license: BSD3 @@ -30,6 +30,10 @@ tested-with: GHC == 7.2.2 GHC == 7.0.4 +extra-source-files: + CHANGELOG.md + README.md + library hs-source-dirs: src/ exposed-modules: Data.Ini @@ -38,7 +42,7 @@ library text, unordered-containers if !impl(ghc >= 8) - build-depends: semigroups >= 0.10 && < 0.19 + build-depends: semigroups >= 0.10 && < 0.21 default-language: Haskell98 default-extensions: OverloadedStrings From 092dd89d38fd9005241e33966ad1bd1db8709379 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 4 Feb 2023 19:56:59 +0100 Subject: [PATCH 7/8] Bump CI to GHC 9.6.0, 9.4.4 and 9.2.5 --- .github/workflows/haskell-ci.yml | 46 ++++++++++++++++++++------------ ini.cabal | 5 ++-- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 6798e15..891f7c4 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.15.20220710 +# version: 0.15.20230203 # -# REGENDATA ("0.15.20220710",["github","ini.cabal"]) +# REGENDATA ("0.15.20230203",["github","ini.cabal"]) # name: Haskell-CI on: @@ -32,14 +32,19 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.4.0.20220623 + - compiler: ghc-9.6.0.20230128 compilerKind: ghc - compilerVersion: 9.4.0.20220623 + compilerVersion: 9.6.0.20230128 setup-method: ghcup allow-failure: true - - compiler: ghc-9.2.3 + - compiler: ghc-9.4.4 compilerKind: ghc - compilerVersion: 9.2.3 + compilerVersion: 9.4.4 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.2.5 + compilerKind: ghc + compilerVersion: 9.2.5 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -115,19 +120,20 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.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.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -145,20 +151,20 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.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.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" fi 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" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -222,7 +228,7 @@ jobs: chmod a+x $HOME/.cabal/bin/cabal-plan cabal-plan --version - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: source - name: initial cabal.project for sdist @@ -260,8 +266,8 @@ jobs: run: | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - - name: cache - uses: actions/cache@v2 + - name: restore cache + uses: actions/cache/restore@v3 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -285,8 +291,14 @@ jobs: ${CABAL} -vnormal check - name: haddock run: | - $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all - name: unconstrained build run: | rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: save cache + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/ini.cabal b/ini.cabal index 0451fcd..1ec9bcb 100644 --- a/ini.cabal +++ b/ini.cabal @@ -14,8 +14,9 @@ category: Data, Configuration build-type: Simple tested-with: - GHC == 9.4.1 - GHC == 9.2.3 + GHC == 9.6.0 + GHC == 9.4.4 + GHC == 9.2.5 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 From 21ed4e6246a0b3406ca3badbb392d03074c5b3d6 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Tue, 7 Feb 2023 14:15:37 -0700 Subject: [PATCH 8/8] Modify mappend to avoid discarding Closes #2 --- CHANGELOG.md | 17 +++++++++++++++++ ini.cabal | 2 +- src/Data/Ini.hs | 7 ++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3b4aa4..f4e5843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## 0.5.0 + +_2023-02-08, Chris Martin_ + +The behavior of `(<>)` for the `Ini` type has changed +[#2](https://github.com/andreasabel/ini/issues/2) + +- `<>` previously discarded all `iniGlobals`. Now it concatenates + the globals from the two `Ini` values. + +- When two `Ini` values contained `iniSections` with the same name, + `<>` previously returned the section from the left value and + discarded the section of the same name from the right value. + Now it concatenates the sections of the same name. + +Tested with GHC 7.0 - ghc-9.6.0.20230128. + ## 0.4.2 _2022-07-26, Andreas Abel_ diff --git a/ini.cabal b/ini.cabal index 1ec9bcb..3193daf 100644 --- a/ini.cabal +++ b/ini.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: ini -version: 0.4.2 +version: 0.5.0 synopsis: Configuration files in the INI format. description: Quick and easy configuration files in the INI format. license: BSD3 diff --git a/src/Data/Ini.hs b/src/Data/Ini.hs index f3201c7..ef3f237 100644 --- a/src/Data/Ini.hs +++ b/src/Data/Ini.hs @@ -89,8 +89,13 @@ data Ini = } deriving (Show, Eq) +-- | '<>' concatenates the lists of entries within each section (since @ini-0.5.0@) instance Semigroup Ini where - x <> y = Ini {iniGlobals = mempty, iniSections = iniSections x <> iniSections y} + x <> y = + Ini + { iniGlobals = iniGlobals x ++ iniGlobals y + , iniSections = M.unionWith (++) (iniSections x) (iniSections y) + } instance Monoid Ini where mempty = Ini {iniGlobals = mempty, iniSections = mempty}