Hello community, here is the log from the commit of package ghc-contravariant for openSUSE:Leap:15.2 checked in at 2020-02-19 18:38:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/ghc-contravariant (Old) and /work/SRC/openSUSE:Leap:15.2/.ghc-contravariant.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-contravariant" Wed Feb 19 18:38:23 2020 rev:11 rq:771266 version:1.5.2 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/ghc-contravariant/ghc-contravariant.changes 2020-01-15 15:01:56.541794991 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.ghc-contravariant.new.26092/ghc-contravariant.changes 2020-02-19 18:38:39.557974246 +0100 @@ -1,0 +2,23 @@ +Fri Nov 8 16:13:29 UTC 2019 - Peter Simons <[email protected]> + +- Drop obsolete group attributes. + +------------------------------------------------------------------- +Tue Jun 4 02:02:26 UTC 2019 - [email protected] + +- Update contravariant to version 1.5.2. + 1.5.2 [2019.06.03] + ------------------ + * Mark `Data.Functor.Contravariant` and `Data.Functor.Contravariant.Generic` + as unconditionally `Trustworthy`. + +------------------------------------------------------------------- +Fri May 3 02:03:03 UTC 2019 - [email protected] + +- Update contravariant to version 1.5.1. + 1.5.1 [2019.05.02] + ------------------ + * Remove the use of `unsafeCoerce` in `Data.Functor.Contravariant.Generic`. As + a result, the `safe` flag has been removed, as it is no longer used. + +------------------------------------------------------------------- Old: ---- contravariant-1.5.tar.gz New: ---- contravariant-1.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-contravariant.spec ++++++ --- /var/tmp/diff_new_pack.g6uKLP/_old 2020-02-19 18:38:40.081975343 +0100 +++ /var/tmp/diff_new_pack.g6uKLP/_new 2020-02-19 18:38:40.085975351 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-contravariant # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,11 +18,10 @@ %global pkg_name contravariant Name: ghc-%{pkg_name} -Version: 1.5 +Version: 1.5.2 Release: 0 Summary: Contravariant functors License: BSD-3-Clause -Group: Development/Libraries/Haskell URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel @@ -35,7 +34,6 @@ %package devel Summary: Haskell %{pkg_name} library development files -Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} ++++++ contravariant-1.5.tar.gz -> contravariant-1.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.5/.travis.yml new/contravariant-1.5.2/.travis.yml --- old/contravariant-1.5/.travis.yml 2018-07-02 01:07:28.000000000 +0200 +++ new/contravariant-1.5.2/.travis.yml 2001-09-09 03:46:40.000000000 +0200 @@ -1,167 +1,179 @@ # This Travis job script has been generated by a script via # -# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project' +# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project' # -# For more information, see https://github.com/hvr/multi-ghc-travis +# For more information, see https://github.com/haskell-CI/haskell-ci +# +# version: 0.3.20190425 # language: c -sudo: false - +dist: xenial git: - submodules: false # whether to recursively clone submodules - + # whether to recursively clone submodules + submodules: false notifications: irc: channels: - - "irc.freenode.org#haskell-lens" + - irc.freenode.org#haskell-lens skip_join: true template: - - "\x0313contravariant\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" - + - "\"\\x0313contravariant\\x03/\\x0306%{branch}\\x03 \\x0314%{commit}\\x03 %{build_url} %{message}\"" cache: directories: - $HOME/.cabal/packages - $HOME/.cabal/store - before_cache: - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log # remove files that are regenerated by 'cabal update' - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx - - - rm -rfv $HOME/.cabal/packages/head.hackage - -addons: - apt: - packages: &apt_packages - - ghc-ppa-tools - - hlint - + - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.* + - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json + - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache + - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar + - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx + - rm -rfv $CABALHOME/packages/head.hackage matrix: include: - - compiler: "ghc-8.6.1" + - compiler: ghc-8.8.1 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}} env: GHCHEAD=true - addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}} - - compiler: "ghc-8.4.3" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}} - - compiler: "ghc-8.2.2" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}} - - compiler: "ghc-8.0.2" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.10.3" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}} - - compiler: "ghc-7.8.4" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}} - - compiler: "ghc-7.6.3" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}} - - compiler: "ghc-7.4.2" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.2.2" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.0.4" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}} - - compiler: "ghc-head" + - compiler: ghc-8.6.5 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}} + - compiler: ghc-8.4.4 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}} + - compiler: ghc-8.2.2 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}} + - compiler: ghc-8.0.2 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}} + - compiler: ghc-7.10.3 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}} + - compiler: ghc-7.8.4 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-2.4"]}} + - compiler: ghc-7.6.3 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.6.3","cabal-install-2.4"]}} + - compiler: ghc-7.4.2 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.4.2","cabal-install-2.4"]}} + - compiler: ghc-7.2.2 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.2.2","cabal-install-2.4"]}} + - compiler: ghc-7.0.4 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.0.4","cabal-install-2.4"]}} + - compiler: ghc-head + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-head","cabal-install-head"]}} env: GHCHEAD=true - addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-head], sources: [hvr-ghc]}} - allow_failures: - - compiler: "ghc-head" - - compiler: "ghc-7.0.4" - - compiler: "ghc-7.2.2" - - compiler: "ghc-8.6.1" - + - compiler: ghc-head + - compiler: ghc-7.0.4 + - compiler: ghc-7.2.2 + - compiler: ghc-8.8.1 before_install: - - HC=${CC} - - HCPKG=${HC/ghc/ghc-pkg} + - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') + - HCPKG="$HC-pkg" - unset CC - - ROOTDIR=$(pwd) - - mkdir -p $HOME/.local/bin - - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH" + - CABAL=/opt/ghc/bin/cabal + - CABALHOME=$HOME/.cabal + - export PATH="$CABALHOME/bin:$PATH" + - TOP=$(pwd) - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') )) - echo $HCNUMVER - + - CABAL="$CABAL -vnormal+nowrap+markoutput" + - set -o pipefail + - | + echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk + echo 'BEGIN { state = "output"; }' >> .colorful.awk + echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk + echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk + echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk + echo ' if (state == "cabal") {' >> .colorful.awk + echo ' print blue($0)' >> .colorful.awk + echo ' } else {' >> .colorful.awk + echo ' print $0' >> .colorful.awk + echo ' }' >> .colorful.awk + echo '}' >> .colorful.awk + - cat .colorful.awk + - | + color_cabal_output () { + awk -f $TOP/.colorful.awk + } + - echo text | color_cabal_output install: - - cabal --version + - ${CABAL} --version - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - - BENCH=${BENCH---enable-benchmarks} - - TEST=${TEST---enable-tests} - - HADDOCK=${HADDOCK-true} - - UNCONSTRAINED=${UNCONSTRAINED-true} - - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false} + - TEST=--enable-tests + - BENCH=--enable-benchmarks - GHCHEAD=${GHCHEAD-false} - - travis_retry cabal update -v - - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config" - - rm -fv cabal.project cabal.project.local - # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage + - rm -f $CABALHOME/config + - | + echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config + echo "remote-build-reporting: anonymous" >> $CABALHOME/config + echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config + echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config + echo "world-file: $CABALHOME/world" >> $CABALHOME/config + echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config + echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config + echo "installdir: $CABALHOME/bin" >> $CABALHOME/config + echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config + echo "store-dir: $CABALHOME/store" >> $CABALHOME/config + echo "install-dirs user" >> $CABALHOME/config + echo " prefix: $CABALHOME" >> $CABALHOME/config + echo "repository hackage.haskell.org" >> $CABALHOME/config + echo " url: http://hackage.haskell.org/" >> $CABALHOME/config - | if $GHCHEAD; then - sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config - for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done - - echo 'repository head.hackage' >> ${HOME}/.cabal/config - echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config - echo ' secure: True' >> ${HOME}/.cabal/config - echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config - echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config - echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config - echo ' key-threshold: 3' >> ${HOME}/.cabal.config - - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - - cabal new-update head.hackage -v + echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config + + echo "repository head.hackage" >> $CABALHOME/config + echo " url: http://head.hackage.haskell.org/" >> $CABALHOME/config + echo " secure: True" >> $CABALHOME/config + echo " root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740" >> $CABALHOME/config + echo " 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb" >> $CABALHOME/config + echo " 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e" >> $CABALHOME/config + echo " key-threshold: 3" >> $CABALHOME/config fi - - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - - "printf 'packages: \".\"\\n' > cabal.project" - - touch cabal.project.local - - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" + - cat $CABALHOME/config + - rm -fv cabal.project cabal.project.local cabal.project.freeze + - travis_retry ${CABAL} v2-update -v + - if [ $HCNUMVER -eq 80801 ] ; then ${CABAL} v2-install -w ${HC} -j2 hlint --constraint='hlint ==2.1.*' | color_cabal_output ; fi + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze + - touch cabal.project + - | + echo 'packages: "."' >> cabal.project + - | + echo "write-ghc-environment-files: always" >> cabal.project + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(contravariant)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - cat cabal.project || true - cat cabal.project.local || true - - if [ -f "./configure.ac" ]; then - (cd "." && autoreconf -i); - fi - - rm -f cabal.project.freeze - - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all - - rm -rf .ghc.environment.* "."/dist - - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) - -# Here starts the actual work to be performed for the package under test; -# any command which exits with a non-zero exit code causes the build to fail. + - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi + - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output + - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" + - rm cabal.project.freeze + - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output script: - # test that source-distributions can be generated - - (cd "." && cabal sdist) - - mv "."/dist/contravariant-*.tar.gz ${DISTDIR}/ + - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) + # Packaging... + - ${CABAL} v2-sdist all | color_cabal_output + # Unpacking... + - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - - "printf 'packages: contravariant-*/*.cabal\\n' > cabal.project" - - touch cabal.project.local - - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze + - touch cabal.project + - | + echo 'packages: "contravariant-*/*.cabal"' >> cabal.project + - | + echo "write-ghc-environment-files: always" >> cabal.project + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(contravariant)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - cat cabal.project || true - cat cabal.project.local || true - + # Building with tests and benchmarks... # build & run tests, build benchmarks - - cabal new-build -w ${HC} ${TEST} ${BENCH} all - - # cabal check - - (cd contravariant-* && cabal check) - - # haddock - - rm -rf ./dist-newstyle - - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi - - # hlint - - (cd contravariant-* && hlint src --cpp-define=HLINT) + - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output + # HLint.. + - if [ $HCNUMVER -eq 80801 ] ; then (cd contravariant-* && hlint --cpp-ansi --cpp-define=HLINT src old-src) ; fi + # cabal check... + - (cd contravariant-* && ${CABAL} -vnormal check) + # haddock... + - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output -# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"] +# REGENDATA ["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"] # EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.5/CHANGELOG.markdown new/contravariant-1.5.2/CHANGELOG.markdown --- old/contravariant-1.5/CHANGELOG.markdown 2018-07-02 01:07:28.000000000 +0200 +++ new/contravariant-1.5.2/CHANGELOG.markdown 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,13 @@ +1.5.2 [2019.06.03] +------------------ +* Mark `Data.Functor.Contravariant` and `Data.Functor.Contravariant.Generic` + as unconditionally `Trustworthy`. + +1.5.1 [2019.05.02] +------------------ +* Remove the use of `unsafeCoerce` in `Data.Functor.Contravariant.Generic`. As + a result, the `safe` flag has been removed, as it is no longer used. + 1.5 [2018.07.01] ---------------- * Support building with GHC 8.6, where `Data.Functor.Contravariant` has been diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.5/contravariant.cabal new/contravariant-1.5.2/contravariant.cabal --- old/contravariant-1.5/contravariant.cabal 2018-07-02 01:07:28.000000000 +0200 +++ new/contravariant-1.5.2/contravariant.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ name: contravariant category: Control, Data -version: 1.5 +version: 1.5.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE @@ -21,8 +21,9 @@ , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2 - , GHC == 8.4.3 - , GHC == 8.6.1 + , GHC == 8.4.4 + , GHC == 8.6.5 + , GHC == 8.8.1 extra-source-files: .travis.yml CHANGELOG.markdown @@ -49,11 +50,6 @@ default: True manual: True -flag safe - description: Get Safe guarantees rather than merely Trustworthy, but with worse constant factors. - default: False - manual: True - flag StateVar description: You can disable the use of the `StateVar` package using `-f-StateVar`. @@ -81,14 +77,11 @@ build-depends: semigroups >= 0.15.2 && < 1 if flag(StateVar) - build-depends: StateVar >= 1.1.1 && < 1.2 + build-depends: StateVar >= 1.1.1 && < 1.3 if impl(ghc >= 7.2 && < 7.6) build-depends: ghc-prim - if flag(safe) - cpp-options: -DSAFE - exposed-modules: Data.Functor.Contravariant.Compose Data.Functor.Contravariant.Divisible @@ -100,4 +93,7 @@ if impl(ghc >= 7.4) exposed-modules: Data.Functor.Contravariant.Generic + if impl(ghc >= 7.10) + ghc-options: -fno-warn-trustworthy-safe + ghc-options: -Wall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.5/old-src/Data/Functor/Contravariant.hs new/contravariant-1.5.2/old-src/Data/Functor/Contravariant.hs --- old/contravariant-1.5/old-src/Data/Functor/Contravariant.hs 2018-07-02 01:07:28.000000000 +0200 +++ new/contravariant-1.5.2/old-src/Data/Functor/Contravariant.hs 2001-09-09 03:46:40.000000000 +0200 @@ -14,13 +14,9 @@ #define MIN_VERSION_base(x,y,z) 1 #endif -#if __GLASGOW_HASKELL__ >= 704 -#if MIN_VERSION_transformers(0,3,0) && MIN_VERSION_tagged(0,6,1) -{-# LANGUAGE Safe #-} -#else +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif -#endif {-# OPTIONS_GHC -fno-warn-deprecations #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.5/src/Data/Functor/Contravariant/Divisible.hs new/contravariant-1.5.2/src/Data/Functor/Contravariant/Divisible.hs --- old/contravariant-1.5/src/Data/Functor/Contravariant/Divisible.hs 2018-07-02 01:07:28.000000000 +0200 +++ new/contravariant-1.5.2/src/Data/Functor/Contravariant/Divisible.hs 2001-09-09 03:46:40.000000000 +0200 @@ -108,7 +108,7 @@ -- parts of a structure. If we postulate the existance of two primitive -- serializers - @string :: Serializer String@ and @int :: Serializer Int@, we -- would like to be able to combine these into a serializer for pairs of --- @String@s and @Int@s. How can we do this? Simply run both serializer and +-- @String@s and @Int@s. How can we do this? Simply run both serializers and -- combine their output! -- -- @ @@ -146,6 +146,7 @@ -- @ -- class Contravariant f => Divisible f where + --- | If one can handle split `a` into `(b, c)`, as well as handle `b`s and `c`s, then one can handle `a`s divide :: (a -> (b, c)) -> f b -> f c -> f a -- | Conquer acts as an identity for combining @Divisible@ functors. @@ -342,7 +343,7 @@ -- functor has the ability to "fan out" input, under the intuition that contravariant -- functors consume input. -- --- In the dicussion for @Divisible@, an example was demonstrated with @Serializer@s, +-- In the discussion for @Divisible@, an example was demonstrated with @Serializer@s, -- that turn @a@s into @ByteString@s. @Divisible@ allowed us to serialize the /product/ -- of multiple values by concatenation. By making our @Serializer@ also @Decidable@- -- we now have the ability to serialize the /sum/ of multiple values - for example diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.5/src/Data/Functor/Contravariant/Generic.hs new/contravariant-1.5.2/src/Data/Functor/Contravariant/Generic.hs --- old/contravariant-1.5/src/Data/Functor/Contravariant/Generic.hs 2018-07-02 01:07:28.000000000 +0200 +++ new/contravariant-1.5.2/src/Data/Functor/Contravariant/Generic.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#ifdef SAFE -{-# LANGUAGE BangPatterns #-} -#elif __GLASGOW_HASKELL__ >= 704 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif {-# LANGUAGE MultiParamTypeClasses #-} @@ -14,6 +12,10 @@ #if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} #endif +{-# LANGUAGE TypeFamilies #-} +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE EmptyCase #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Contravariant.Generic @@ -36,9 +38,6 @@ import Data.Functor.Contravariant import Data.Functor.Contravariant.Divisible import GHC.Generics -#ifndef SAFE -import Unsafe.Coerce -#endif -- | This provides machinery for deconstructing an arbitrary 'Generic' instance using a 'Decidable' 'Contravariant' functor. -- @@ -53,13 +52,52 @@ -- geq :: 'Deciding' 'Eq' a => a -> a -> 'Bool' -- geq = 'getEquivalence' $ 'deciding' (Proxy :: Proxy 'Eq') ('Equivalence' ('==')) -- @ -class (Generic a, GDeciding q (Rep a)) => Deciding q a where +class (Generic a, GDeciding q (Rep' a)) => Deciding q a where #ifndef HLINT deciding :: Decidable f => p q -> (forall b. q b => f b) -> f a #endif -instance (Generic a, GDeciding q (Rep a)) => Deciding q a where - deciding p q = contramap from $ gdeciding p q +instance (Generic a, GG (Rep a), GDeciding q (Rep' a)) => Deciding q a where + deciding p q = contramap (swizzle . from) $ gdeciding p q + +type Rep' a = Swizzle (Rep a) +type Rep1' f = Swizzle (Rep1 f) +type family Swizzle (r :: * -> *) :: * -> * +type instance Swizzle (M1 i c f) = M1 i c (Swizzle f) +type instance Swizzle V1 = V1 +type instance Swizzle U1 = U1 +type instance Swizzle Par1 = Par1 +type instance Swizzle (Rec1 f) = Rec1 f +type instance Swizzle (K1 i c) = K1 i c +type instance Swizzle (f :+: g) = Swizzle f ::+: Swizzle g +type instance Swizzle (f :*: g) = Swizzle f ::*: Swizzle g +type instance Swizzle (f :.: g) = f :.: Swizzle g + +newtype (::+:) f g a = Sum {unSum :: Either (f a) (g a)} +newtype (::*:) f g a = Prod {unProd :: (f a, g a)} + +class GG r where + swizzle :: r p -> Swizzle r p +instance GG f => GG (M1 i c f) where + swizzle (M1 a) = M1 (swizzle a) +instance GG V1 where swizzle v = v +instance GG U1 where swizzle v = v +instance GG (K1 i c) where swizzle v = v +instance GG Par1 where swizzle v = v +instance GG (Rec1 f) where swizzle v = v +instance (GG f, GG g) => GG (f :+: g) where + {-# INLINE swizzle #-} + swizzle (L1 x) = Sum (Left (swizzle x)) + swizzle (R1 x) = Sum (Right (swizzle x)) +instance (GG f, GG g) => GG (f :*: g) where + {-# INLINE swizzle #-} + swizzle (x :*: y) = Prod (swizzle x, swizzle y) +{- +-- This instance wouldn't be that efficient. But we don't +-- offer instances for compositions anyway. +instance (Functor f, GG g) => GG (f :.: g) where + swizzle (Comp1 x) = Comp1 (fmap swizzle x) +-} -- | This provides machinery for deconstructing an arbitrary 'Generic1' instance using a 'Decidable' 'Contravariant' functor. -- @@ -74,13 +112,13 @@ -- geq1 :: 'Deciding1' 'Eq' f => (a -> a -> 'Bool') -> f a -> f a -> 'Bool' -- geq1 f = 'getEquivalence' $ 'deciding1' (Proxy :: Proxy 'Eq') ('Equivalence' ('==')) ('Equivalence' f) -- @ -class (Generic1 t, GDeciding1 q (Rep1 t)) => Deciding1 q t where +class (Generic1 t, GDeciding1 q (Rep1' t)) => Deciding1 q t where #ifndef HLINT deciding1 :: Decidable f => p q -> (forall b. q b => f b) -> f a -> f (t a) #endif -instance (Generic1 t, GDeciding1 q (Rep1 t)) => Deciding1 q t where - deciding1 p q r = contramap from1 $ gdeciding1 p q r +instance (Generic1 t, GDeciding1 q (Rep1' t), GG (Rep1 t)) => Deciding1 q t where + deciding1 p q r = contramap (swizzle . from1) $ gdeciding1 p q r class GDeciding q t where #ifndef HLINT @@ -93,10 +131,10 @@ instance GDeciding q V1 where gdeciding _ _ = glose -instance (GDeciding q f, GDeciding q g) => GDeciding q (f :*: g) where +instance (GDeciding q f, GDeciding q g) => GDeciding q (f ::*: g) where gdeciding p q = gdivide (gdeciding p q) (gdeciding p q) -instance (GDeciding q f, GDeciding q g) => GDeciding q (f :+: g) where +instance (GDeciding q f, GDeciding q g) => GDeciding q (f ::+: g) where gdeciding p q = gchoose (gdeciding p q) (gdeciding p q) #ifndef HLINT @@ -118,36 +156,29 @@ instance GDeciding1 q V1 where gdeciding1 _ _ _ = glose -instance (GDeciding1 q f, GDeciding1 q g) => GDeciding1 q (f :*: g) where +instance (GDeciding1 q f, GDeciding1 q g) => GDeciding1 q (f ::*: g) where gdeciding1 p q r = gdivide (gdeciding1 p q r) (gdeciding1 p q r) -instance (GDeciding1 q f, GDeciding1 q g) => GDeciding1 q (f :+: g) where +instance (GDeciding1 q f, GDeciding1 q g) => GDeciding1 q (f ::+: g) where gdeciding1 p q r = gchoose (gdeciding1 p q r) (gdeciding1 p q r) - - -glose :: Decidable f => f (V1 a) -#ifdef SAFE -glose = lose (\ !_ -> error "impossible") +absurd1 :: V1 a -> b +#if defined(HLINT) || (__GLASGOW_HASKELL__ < 708) +absurd1 x = x `seq` error "impossible" #else -glose = lose unsafeCoerce +absurd1 x = case x of #endif + +glose :: Decidable f => f (V1 a) +glose = lose absurd1 {-# INLINE glose #-} -gdivide :: Divisible f => f (g a) -> f (h a) -> f ((g:*:h) a) -#ifdef SAFE -gdivide = divide (\(f:*:g) -> (f,g)) -#else -gdivide = divide unsafeCoerce -#endif +gdivide :: Divisible f => f (g a) -> f (h a) -> f ((g::*:h) a) +gdivide = divide unProd {-# INLINE gdivide #-} -gchoose :: Decidable f => f (g a) -> f (h a) -> f ((g:+:h) a) -#ifdef SAFE -gchoose = choose (\xs -> case xs of L1 a -> Left a; R1 b -> Right b) -#else -gchoose = choose unsafeCoerce -#endif +gchoose :: Decidable f => f (g a) -> f (h a) -> f ((g::+:h) a) +gchoose = choose unSum {-# INLINE gchoose #-} #ifndef HLINT
