Hello community, here is the log from the commit of package ghc-reflection for openSUSE:Factory checked in at 2019-08-29 17:22:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-reflection (Old) and /work/SRC/openSUSE:Factory/.ghc-reflection.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-reflection" Thu Aug 29 17:22:06 2019 rev:4 rq:726814 version:2.1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-reflection/ghc-reflection.changes 2019-06-19 21:12:46.710764548 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-reflection.new.7948/ghc-reflection.changes 2019-08-29 17:22:08.995321161 +0200 @@ -1,0 +2,8 @@ +Wed Aug 28 02:02:20 UTC 2019 - psim...@suse.com + +- Update reflection to version 2.1.5. + # 2.1.5 [2019.08.27] + * Fix a bug in which `reifyNat` would yield incorrect results for very large + `Integer`s on GHC 8.2 or later. + +------------------------------------------------------------------- Old: ---- reflection-2.1.4.tar.gz reflection.cabal New: ---- reflection-2.1.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-reflection.spec ++++++ --- /var/tmp/diff_new_pack.J59AYA/_old 2019-08-29 17:22:09.779321030 +0200 +++ /var/tmp/diff_new_pack.J59AYA/_new 2019-08-29 17:22:09.779321030 +0200 @@ -17,18 +17,22 @@ %global pkg_name reflection +%bcond_with tests Name: ghc-%{pkg_name} -Version: 2.1.4 +Version: 2.1.5 Release: 0 Summary: Reifies arbitrary terms into types that can be reflected back into terms 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 -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-template-haskell-devel +%if %{with tests} +BuildRequires: ghc-QuickCheck-devel +BuildRequires: ghc-hspec-devel +%endif %description This package addresses the /configuration problem/ which is propagating @@ -59,7 +63,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build @@ -67,6 +70,9 @@ %install %ghc_lib_install +%check +%cabal_test + %post devel %ghc_pkg_recache ++++++ reflection-2.1.4.tar.gz -> reflection-2.1.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/.travis.yml new/reflection-2.1.5/.travis.yml --- old/reflection-2.1.4/.travis.yml 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/.travis.yml 2001-09-09 03:46:40.000000000 +0200 @@ -1,161 +1,186 @@ # This Travis job script has been generated by a script via # -# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--jobs=2' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-install-dependencies' '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.20190815 # 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: - - "\x0313reflection\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" - + - "\"\\x0313reflection\\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 - + - 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" - env: GHCHEAD=true - addons: {apt: {packages: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}} - - compiler: "ghc-head" - env: GHCHEAD=true - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}} - + - compiler: ghc-8.8.1 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}} + - 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"]}} 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/-/\//') + - WITHCOMPILER="-w $HC" + - 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" - - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') )) + - CABAL=/opt/ghc/bin/cabal + - CABALHOME=$HOME/.cabal + - export PATH="$CABALHOME/bin:$PATH" + - TOP=$(pwd) + - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $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} - - GHCHEAD=${GHCHEAD-false} - - travis_retry cabal update -v - - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config" - - rm -fv cabal.project cabal.project.local - - "sed -i.bak 's/^-- jobs:.*/jobs: 2/' ${HOME}/.cabal/config" - # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage - - | - 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 + - TEST=--enable-tests + - BENCH=--enable-benchmarks + - HEADHACKAGE=false + - if [ $HCNUMVER -ge 80800 ] ; then HEADHACKAGE=true ; fi + - rm -f $CABALHOME/config + - | + echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config + echo "remote-build-reporting: anonymous" >> $CABALHOME/config + echo "write-ghc-environment-files: always" >> $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 $HEADHACKAGE; then + echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config + echo "repository head.hackage.ghc.haskell.org" >> $CABALHOME/config + echo " url: https://ghc.gitlab.haskell.org/head.hackage/" >> $CABALHOME/config + echo " secure: True" >> $CABALHOME/config + echo " root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config + echo " 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config + echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $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" + - "echo 'jobs: 2' >> $CABALHOME/config" + - cat $CABALHOME/config + - rm -fv cabal.project cabal.project.local cabal.project.freeze + - travis_retry ${CABAL} v2-update -v + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze + - touch cabal.project + - | + echo "packages: ." >> cabal.project + if [ $HCNUMVER -ge 71000 ] ; then echo "packages: ./examples" >> cabal.project ; fi + - | + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(reflection|reflection-examples)$' || true) | 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 - - 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 + - if [ -f "./examples/configure.ac" ]; then (cd "./examples" && autoreconf -i); fi + - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output + - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" + - rm cabal.project.freeze script: - # test that source-distributions can be generated - - (cd "." && cabal sdist) - - mv "."/dist/reflection-*.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: reflection-*/*.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" + - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \; + - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \; + - PKGDIR_reflection="$(find . -maxdepth 1 -type d -regex '.*/reflection-[0-9.]*')" + - PKGDIR_reflection_examples="$(find . -maxdepth 1 -type d -regex '.*/reflection-examples-[0-9.]*')" + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze + - touch cabal.project + - | + echo "packages: ${PKGDIR_reflection}" >> cabal.project + if [ $HCNUMVER -ge 71000 ] ; then echo "packages: ${PKGDIR_reflection_examples}" >> cabal.project ; fi + - | + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(reflection|reflection-examples)$' || true) | 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 reflection-* && cabal check) - - # haddock - - rm -rf ./dist-newstyle - - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi - - # Build without installed constraints for packages in global-db - - if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi + - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + # Testing... + - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + # cabal check... + - (cd ${PKGDIR_reflection} && ${CABAL} -vnormal check) + - if [ $HCNUMVER -ge 71000 ] ; then (cd ${PKGDIR_reflection_examples} && ${CABAL} -vnormal check) ; fi + # haddock... + - ${CABAL} v2-haddock $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + # Building without installed constraints for packages in global-db... + - rm -f cabal.project.local + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output -# REGENDATA ["-o",".travis.yml","--ghc-head","--jobs=2","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-install-dependencies","cabal.project"] +# REGENDATA ["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"] # EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/CHANGELOG.markdown new/reflection-2.1.5/CHANGELOG.markdown --- old/reflection-2.1.4/CHANGELOG.markdown 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/CHANGELOG.markdown 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,7 @@ +# 2.1.5 [2019.08.27] +* Fix a bug in which `reifyNat` would yield incorrect results for very large + `Integer`s on GHC 8.2 or later. + # 2.1.4 [2018.07.02] * Allow building with GHC 8.6. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/examples/Constraints.hs new/reflection-2.1.5/examples/Constraints.hs --- old/reflection-2.1.4/examples/Constraints.hs 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/examples/Constraints.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,12 +1,14 @@ -{-# LANGUAGE Rank2Types, TypeFamilies, TypeOperators, ConstraintKinds, PolyKinds, FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, FlexibleContexts, UndecidableInstances #-} +{-# LANGUAGE Rank2Types, TypeFamilies, TypeOperators, ConstraintKinds, PolyKinds, FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, FlexibleContexts, UndecidableInstances, CPP #-} module Constraints where -import Control.Newtype -- from newtype -import Data.Constraint -- from constraints -import Data.Constraint.Unsafe -- from constraints -import Data.Monoid -- from base -import Data.Proxy -- from tagged -import Data.Reflection -- from reflection +import Control.Newtype -- from newtype +import Data.Constraint -- from constraints +import Data.Constraint.Unsafe -- from constraints +import Data.Proxy -- from tagged +import Data.Reflection -- from reflection +#if !(MIN_VERSION_base(4,11,0)) +import Data.Semigroup -- from semigroups +#endif -- | Values in our dynamically constructed monoid over 'a' newtype Lift (p :: * -> Constraint) (a :: *) (s :: *) = Lift { lower :: a } @@ -42,8 +44,11 @@ data Def Monoid a = Monoid { mappend_ :: a -> a -> a, mempty_ :: a } reifiedIns = Sub Dict +instance Reifies s (Def Monoid a) => Semigroup (Lift Monoid a s) where + a <> b = Lift $ mappend_ (reflect a) (lower a) (lower b) + instance Reifies s (Def Monoid a) => Monoid (Lift Monoid a s) where - mappend a b = Lift $ mappend_ (reflect a) (lower a) (lower b) + mappend = (<>) mempty = a where a = Lift $ mempty_ (reflect a) data ClassProxy (p :: * -> Constraint) = ClassProxy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/examples/FromJSON.hs new/reflection-2.1.5/examples/FromJSON.hs --- old/reflection-2.1.4/examples/FromJSON.hs 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/examples/FromJSON.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,27 +1,29 @@ -- Example of a dynamically generated FromJSON instance. -- --- Can be useful when one needs to use a function with a --- FromJSON constraint, but some detail about the +-- Can be useful when one needs to use a function with a +-- FromJSON constraint, but some detail about the -- conversion from JSON is not known until runtime. +{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} -import Data.Reflection -- from reflection -import Data.Monoid -- from base -import Data.Proxy -- from tagged -import Data.Text -- from text -import Data.Monoid -import Data.Aeson -- from aeson +import Data.Aeson -- from aeson import Data.Aeson.Types (Parser) +import Data.Proxy -- from tagged +import Data.Reflection -- from reflection +#if !(MIN_VERSION_base(4,11,0)) +import Data.Semigroup -- from base +#endif +import Data.Text (Text, pack) -- from text import Control.Applicative -- These imports are only for constructing the example value -import Control.Lens (preview) -- from lens -import Data.Aeson.Lens (_Value,_String) -- form lens-aeson +import Lens.Micro.Aeson (_Value) -- form microlens-aeson +import Lens.Micro.Extras (preview) -- from microlens data Foo = Foo { @@ -35,15 +37,16 @@ -- A wrapper over Foo carrying a phantom type s newtype J a s = J { runJ :: a } - --- If the phantom type s reifies the parsing function, we can --- use reflect to recover the function and implement + +-- If the phantom type s reifies the parsing function, we can +-- use reflect to recover the function and implement -- our FromJSON instance for J. instance Reifies s (Object -> Parser a) => FromJSON (J a s) where parseJSON (Object v) = J <$> reflect (Proxy :: Proxy s) v - + parseJSON _ = empty + -- Convince the compiler that the phantom type in the proxy --- supplied by reify is the same as the phantom type in J. +-- supplied by reify is the same as the phantom type in J. -- -- Otherwise the FromJSON instance for J won't kick in. asProxyJ :: Proxy s -> J a s -> J a s @@ -53,18 +56,18 @@ exampleJSON = maybe Null id (preview _Value str) where str = "{ \"zzfield1\" : 5, \"zzfield2\" : 7 }"::Text - + main :: IO () main = do putStrLn "Enter prefix for the fields: " -- "zz" must be entered for the parse to succeed prefix <- fmap pack getLine - + -- fromJSON uses the dynamically generated FromJSON instance let result = reify (fooParser prefix) $ \proxy -> -- We must eliminate the J newtype before returning -- because, thanks to parametricity, -- the phantom type cannot escape the callback. - runJ . asProxyJ proxy <$> fromJSON exampleJSON - + runJ . asProxyJ proxy <$> fromJSON exampleJSON + putStrLn (show (result :: Result Foo)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/examples/Monoid.hs new/reflection-2.1.5/examples/Monoid.hs --- old/reflection-2.1.4/examples/Monoid.hs 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/examples/Monoid.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,9 +1,11 @@ {-# LANGUAGE CPP, Rank2Types, FlexibleContexts, UndecidableInstances #-} module Monoid where +import Data.Proxy -- from tagged import Data.Reflection -- from reflection +#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup -- from base -import Data.Proxy -- from tagged +#endif -- | Values in our dynamically-constructed 'Monoid' over 'a' newtype M a s = M { runM :: a } deriving (Eq,Ord) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/examples/ReaderLike.hs new/reflection-2.1.5/examples/ReaderLike.hs --- old/reflection-2.1.4/examples/ReaderLike.hs 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/examples/ReaderLike.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,7 +9,6 @@ import Data.Proxy import Data.Reflection -import Control.Applicative import System.IO data MyConfig = MyConfig @@ -37,7 +36,7 @@ conf = reflect (Proxy :: Proxy p) run :: forall p. (Reifies p MyConfig) => Proxy p -> IO () -run p = do +run _ = do d1 <- ask "Datum 1:" :: IO (Datum p) d2 <- ask "Datum 2:" :: IO (Datum p) -- look ma, no plumbing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/examples/reflection-examples.cabal new/reflection-2.1.5/examples/reflection-examples.cabal --- old/reflection-2.1.4/examples/reflection-examples.cabal 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/examples/reflection-examples.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -15,16 +15,12 @@ 2004 Oleg Kiselyov and Chung-chieh Shan build-type: Simple cabal-version: >= 1.10 -tested-with: GHC == 7.0.4 - , GHC == 7.2.2 - , GHC == 7.4.2 - , GHC == 7.6.3 - , GHC == 7.8.4 - , GHC == 7.10.3 +tested-with: 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 flag examples default: True @@ -38,6 +34,7 @@ constraints, newtype, reflection, + semigroups, tagged hs-source-dirs: . ghc-options: -Wall @@ -49,9 +46,10 @@ main-is: FromJSON.hs build-depends: aeson, base >= 4.8 && < 5, - lens, - lens-aeson, + microlens, + microlens-aeson, reflection, + semigroups, tagged, text hs-source-dirs: . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/fast/Data/Reflection.hs new/reflection-2.1.5/fast/Data/Reflection.hs --- old/reflection-2.1.4/fast/Data/Reflection.hs 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/fast/Data/Reflection.hs 2001-09-09 03:46:40.000000000 +0200 @@ -133,6 +133,11 @@ #if (__GLASGOW_HASKELL__ >= 707) || (defined(MIN_VERSION_template_haskell) && USE_TYPE_LITS) import GHC.TypeLits +# if MIN_VERSION_base(4,10,0) +import Numeric.Natural (Natural) +# elif __GLASGOW_HASKELL__ >= 707 +import Control.Exception (ArithException(..), throw) +# endif #endif #ifdef __HUGS__ @@ -187,6 +192,9 @@ -- | This upgraded version of 'reify' can be used to generate a 'KnownNat' suitable for use with other APIs. -- +-- Attemping to pass a negative 'Integer' as an argument will result in an +-- 'Underflow' exception. +-- -- /Available only on GHC 7.8+/ -- -- >>> reifyNat 4 natVal @@ -196,7 +204,17 @@ -- 4 reifyNat :: forall r. Integer -> (forall (n :: Nat). KnownNat n => Proxy n -> r) -> r -reifyNat n k = unsafeCoerce (MagicNat k :: MagicNat r) n Proxy +reifyNat n k = unsafeCoerce (MagicNat k :: MagicNat r) +# if MIN_VERSION_base(4,10,0) + -- Starting with base-4.10, the internal + -- representation of KnownNat changed from Integer + -- to Natural, so make sure to perform the same + -- conversion before unsafeCoercing. + (fromInteger n :: Natural) +# else + (if n < 0 then throw Underflow else n) +# endif + Proxy -------------------------------------------------------------------------------- -- KnownSymbol diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/reflection.cabal new/reflection-2.1.5/reflection.cabal --- old/reflection-2.1.4/reflection.cabal 2018-07-03 02:07:12.000000000 +0200 +++ new/reflection-2.1.5/reflection.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: reflection -version: 2.1.4 +version: 2.1.5 license: BSD3 license-file: LICENSE author: Edward A. Kmett, Elliott Hird, Oleg Kiselyov and Chung-chieh Shan @@ -35,8 +35,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: examples/reflection-examples.cabal @@ -81,7 +82,7 @@ if !impl(ghc >= 8.0) build-depends: - semigroups >= 0.11 && < 0.19 + semigroups >= 0.11 && < 0.20 default-language: Haskell98 @@ -105,3 +106,17 @@ CPP exposed-modules: Data.Reflection + +test-suite spec + type: exitcode-stdio-1.0 + hs-source-dirs: tests + main-is: Spec.hs + other-modules: ReifyNatSpec + ghc-options: -Wall + default-language: Haskell98 + build-tool-depends: hspec-discover:hspec-discover >= 1.8 + build-depends: + base >= 2 && < 5, + hspec >= 2 && < 3, + QuickCheck >= 2 && < 3, + reflection diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/tests/ReifyNatSpec.hs new/reflection-2.1.5/tests/ReifyNatSpec.hs --- old/reflection-2.1.4/tests/ReifyNatSpec.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/reflection-2.1.5/tests/ReifyNatSpec.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,45 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ScopedTypeVariables #-} +module ReifyNatSpec where + +#if __GLASGOW_HASKELL__ >= 708 +import Control.Exception (ArithException(..), evaluate) +import Data.Reflection +import Test.Hspec.QuickCheck +import Test.QuickCheck (Negative(..), NonNegative(..)) + +# if MIN_VERSION_base(4,10,0) +import GHC.TypeNats (natVal) +import Numeric.Natural (Natural) +# endif +#endif + +import Test.Hspec + +main :: IO () +main = hspec spec + +spec :: Spec +spec = +#if __GLASGOW_HASKELL__ >= 708 + describe "reifyNat" $ do + prop "reify positive Integers and reflect them back" $ + \(NonNegative (i :: Integer)) -> reifyNat i $ \p -> reflect p `shouldBe` i + prop "should throw an Underflow exception on negative inputs" $ + \(Negative (i :: Integer)) -> + reifyNat i (evaluate . reflect) `shouldThrow` (== Underflow) +# if MIN_VERSION_base(4,10,0) + it "should reflect very large Naturals correctly" $ do -- #41 + let d42, d2_63, d2_64 :: Natural + d42 = 42 + d2_63 = 2^(63 :: Natural) + d2_64 = 2^(64 :: Natural) + reifyNat (toInteger d42) $ \p -> natVal p `shouldBe` d42 + reifyNat (toInteger (d2_63-1)) $ \p -> natVal p `shouldBe` d2_63-1 + reifyNat (toInteger d2_63) $ \p -> natVal p `shouldBe` d2_63 + reifyNat (toInteger (d2_64-1)) $ \p -> natVal p `shouldBe` d2_64-1 + reifyNat (toInteger d2_64) $ \p -> natVal p `shouldBe` d2_64 +# endif +#else + return () +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2.1.4/tests/Spec.hs new/reflection-2.1.5/tests/Spec.hs --- old/reflection-2.1.4/tests/Spec.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/reflection-2.1.5/tests/Spec.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1 @@ +{-# OPTIONS_GHC -F -pgmF hspec-discover #-}