Hello community, here is the log from the commit of package ghc-bifunctors for openSUSE:Factory checked in at 2019-08-29 17:20:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-bifunctors (Old) and /work/SRC/openSUSE:Factory/.ghc-bifunctors.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-bifunctors" Thu Aug 29 17:20:03 2019 rev:15 rq:726806 version:5.5.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-bifunctors/ghc-bifunctors.changes 2019-06-19 21:11:55.886715168 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-bifunctors.new.7948/ghc-bifunctors.changes 2019-08-29 17:20:05.919341655 +0200 @@ -1,0 +2,12 @@ +Wed Aug 28 02:02:23 UTC 2019 - [email protected] + +- Update bifunctors to version 5.5.5. + 5.5.5 [2019.08.27] + ------------------ + * Add `Eq{1,2}`, `Ord{1,2}`, `Read{1,2}`, and `Show{1,2}` instances for data + types in the `Data.Bifunctor.*` module namespace where possible. The + operative phrase is "where possible" since many of these instances require + the use of `Eq2`/`Ord2`/`Read2`/`Show2`, which are not avaiable when + built against `transformers-0.4.*`. + +------------------------------------------------------------------- Old: ---- bifunctors-5.5.4.tar.gz bifunctors.cabal New: ---- bifunctors-5.5.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-bifunctors.spec ++++++ --- /var/tmp/diff_new_pack.nKb6x5/_old 2019-08-29 17:20:06.667341531 +0200 +++ /var/tmp/diff_new_pack.nKb6x5/_new 2019-08-29 17:20:06.671341530 +0200 @@ -19,14 +19,13 @@ %global pkg_name bifunctors %bcond_with tests Name: ghc-%{pkg_name} -Version: 5.5.4 +Version: 5.5.5 Release: 0 Summary: Collection Haskell 98 bifunctors, bifoldables and bitraversables License: BSD-2-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-base-orphans-devel BuildRequires: ghc-comonad-devel @@ -58,7 +57,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ bifunctors-5.5.4.tar.gz -> bifunctors-5.5.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/.travis.yml new/bifunctors-5.5.5/.travis.yml --- old/bifunctors-5.5.4/.travis.yml 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/.travis.yml 2001-09-09 03:46:40.000000000 +0200 @@ -4,27 +4,24 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.2.1 +# version: 0.3.20190425 # language: c 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: - - "\x0313bifunctors\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" - + - "\"\\x0313bifunctors\\x03/\\x0306%{branch}\\x03 \\x0314%{commit}\\x03 %{build_url} %{message}\"" cache: directories: - $HOME/.cabal/packages - $HOME/.cabal/store - before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log # remove files that are regenerated by 'cabal update' @@ -33,122 +30,149 @@ - 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.4" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}} - - compiler: "ghc-8.4.4" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}} - - compiler: "ghc-8.2.2" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}} - - compiler: "ghc-8.0.2" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.10.3" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}} - - compiler: "ghc-7.8.4" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.8.4], sources: [hvr-ghc]}} - - compiler: "ghc-7.6.3" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.6.3], sources: [hvr-ghc]}} - - compiler: "ghc-7.4.2" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.4.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.2.2" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.2.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.0.4" - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.0.4], sources: [hvr-ghc]}} - - compiler: "ghc-head" + - compiler: ghc-8.8.1 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}} + env: GHCHEAD=true + - 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: [ghc-ppa-tools,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-head + - compiler: ghc-7.0.4 + - compiler: ghc-7.2.2 + - compiler: ghc-8.8.1 before_install: - - HC=/opt/ghc/bin/${CC} - - HCPKG=${HC/ghc/ghc-pkg} + - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') + - HCPKG="$HC-pkg" - unset CC - CABAL=/opt/ghc/bin/cabal - CABALHOME=$HOME/.cabal - export PATH="$CABALHOME/bin:$PATH" - - ROOTDIR=$(pwd) + - 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 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - TEST=--enable-tests - BENCH=--enable-benchmarks - GHCHEAD=${GHCHEAD-false} - - travis_retry ${CABAL} update -v - - sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/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/' $CABALHOME/config - for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" $CABALHOME/config; done - - 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 - - grep -Ev -- '^\s*--' $CABALHOME/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*--' $CABALHOME/config | grep -Ev '^\s*$' - - rm -f cabal.project + - 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 - - "printf 'packages: \".\"\\n' >> cabal.project" - - "printf 'write-ghc-environment-files: always\\n' >> cabal.project" - - touch cabal.project.local + - | + 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 -- '^(bifunctors)$' | 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-freeze -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dry - - "cat \"cabal.project.freeze\" | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" - - rm "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. + - ${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 - - ${CABAL} new-sdist all + - 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 '{}' \; - - rm -f cabal.project + # Generate cabal.project + - rm -rf cabal.project cabal.project.local cabal.project.freeze - touch cabal.project - - "printf 'packages: \"bifunctors-*/*.cabal\"\\n' >> cabal.project" - - "printf 'write-ghc-environment-files: always\\n' >> cabal.project" - - touch cabal.project.local + - | + echo 'packages: "bifunctors-*/*.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 -- '^(bifunctors)$' | 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 - - if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi - - # cabal check - - (cd bifunctors-* && ${CABAL} check) - - # haddock - - ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all + - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output + # Testing... + - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output + # cabal check... + - (cd bifunctors-* && ${CABAL} -vnormal check) + # haddock... + - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output # REGENDATA ["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"] # EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/CHANGELOG.markdown new/bifunctors-5.5.5/CHANGELOG.markdown --- old/bifunctors-5.5.4/CHANGELOG.markdown 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/CHANGELOG.markdown 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,11 @@ +5.5.5 [2019.08.27] +------------------ +* Add `Eq{1,2}`, `Ord{1,2}`, `Read{1,2}`, and `Show{1,2}` instances for data + types in the `Data.Bifunctor.*` module namespace where possible. The + operative phrase is "where possible" since many of these instances require + the use of `Eq2`/`Ord2`/`Read2`/`Show2`, which are not avaiable when + built against `transformers-0.4.*`. + 5.5.4 [2019.04.26] ------------------ * Support `th-abstraction-0.3` or later. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/bifunctors.cabal new/bifunctors-5.5.5/bifunctors.cabal --- old/bifunctors-5.5.4/bifunctors.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/bifunctors.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ name: bifunctors category: Data, Functors -version: 5.5.4 +version: 5.5.5 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE @@ -22,8 +22,13 @@ , GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 - , GHC == 8.6.4 -extra-source-files: .travis.yml CHANGELOG.markdown README.markdown + , GHC == 8.6.5 + , GHC == 8.8.1 +extra-source-files: + .travis.yml + CHANGELOG.markdown + README.markdown + include/bifunctors-common.h source-repository head type: git @@ -47,13 +52,15 @@ library hs-source-dirs: src + include-dirs: include + includes: bifunctors-common.h build-depends: base >= 4 && < 5, base-orphans >= 0.5.2 && < 1, comonad >= 4 && < 6, containers >= 0.1 && < 0.7, - template-haskell >= 2.4 && < 2.15, - th-abstraction >= 0.2.2 && < 0.4, + template-haskell >= 2.4 && < 2.16, + th-abstraction >= 0.3 && < 0.4, transformers >= 0.2 && < 0.6 if !impl(ghc > 8.2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/include/bifunctors-common.h new/bifunctors-5.5.5/include/bifunctors-common.h --- old/bifunctors-5.5.4/include/bifunctors-common.h 1970-01-01 01:00:00.000000000 +0100 +++ new/bifunctors-5.5.5/include/bifunctors-common.h 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,19 @@ +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(x,y,z) 1 +#endif + +#ifndef MIN_VERSION_transformers_compat +#define MIN_VERSION_transformers_compat(x,y,z) 0 +#endif + +#if MIN_VERSION_base(4,9,0) +#define LIFTED_FUNCTOR_CLASSES 1 +#else +#if MIN_VERSION_transformers(0,5,0) +#define LIFTED_FUNCTOR_CLASSES 1 +#else +#if MIN_VERSION_transformers_compat(0,5,0) && !MIN_VERSION_transformers(0,4,0) +#define LIFTED_FUNCTOR_CLASSES 1 +#endif +#endif +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Biff.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Biff.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Biff.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Biff.hs 2001-09-09 03:46:40.000000000 +0200 @@ -19,6 +19,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -56,6 +57,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + -- | Compose two 'Functor's on the inside of a 'Bifunctor'. newtype Biff p f g a b = Biff { runBiff :: p (f a) (g b) } deriving ( Eq, Ord, Show, Read @@ -93,6 +98,39 @@ # endif #endif +#if LIFTED_FUNCTOR_CLASSES +instance (Eq2 p, Eq1 f, Eq1 g, Eq a) => Eq1 (Biff p f g a) where + liftEq = liftEq2 (==) +instance (Eq2 p, Eq1 f, Eq1 g) => Eq2 (Biff p f g) where + liftEq2 f g (Biff x) (Biff y) = liftEq2 (liftEq f) (liftEq g) x y + +instance (Ord2 p, Ord1 f, Ord1 g, Ord a) => Ord1 (Biff p f g a) where + liftCompare = liftCompare2 compare +instance (Ord2 p, Ord1 f, Ord1 g) => Ord2 (Biff p f g) where + liftCompare2 f g (Biff x) (Biff y) = liftCompare2 (liftCompare f) (liftCompare g) x y + +instance (Read2 p, Read1 f, Read1 g, Read a) => Read1 (Biff p f g a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance (Read2 p, Read1 f, Read1 g) => Read2 (Biff p f g) where + liftReadsPrec2 rp1 rl1 rp2 rl2 p = readParen (p > 10) $ \s0 -> do + ("Biff", s1) <- lex s0 + ("{", s2) <- lex s1 + ("runBiff", s3) <- lex s2 + (x, s4) <- liftReadsPrec2 (liftReadsPrec rp1 rl1) (liftReadList rp1 rl1) + (liftReadsPrec rp2 rl2) (liftReadList rp2 rl2) 0 s3 + ("}", s5) <- lex s4 + return (Biff x, s5) + +instance (Show2 p, Show1 f, Show1 g, Show a) => Show1 (Biff p f g a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance (Show2 p, Show1 f, Show1 g) => Show2 (Biff p f g) where + liftShowsPrec2 sp1 sl1 sp2 sl2 p (Biff x) = showParen (p > 10) $ + showString "Biff {runBiff = " + . liftShowsPrec2 (liftShowsPrec sp1 sl1) (liftShowList sp1 sl1) + (liftShowsPrec sp2 sl2) (liftShowList sp2 sl2) 0 x + . showChar '}' +#endif + instance (Bifunctor p, Functor f, Functor g) => Bifunctor (Biff p f g) where first f = Biff . first (fmap f) . runBiff {-# INLINE first #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Clown.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Clown.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Clown.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Clown.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,6 +16,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -40,6 +41,7 @@ import Data.Biapplicative import Data.Bifoldable import Data.Bitraversable +import Data.Functor.Classes #if __GLASGOW_HASKELL__ < 710 import Data.Foldable @@ -93,6 +95,67 @@ to1 = Clown . unK1 . unM1 . unM1 . unM1 #endif +#if LIFTED_FUNCTOR_CLASSES +instance (Eq1 f, Eq a) => Eq1 (Clown f a) where + liftEq = liftEq2 (==) +instance Eq1 f => Eq2 (Clown f) where + liftEq2 f _ = eqClown (liftEq f) + +instance (Ord1 f, Ord a) => Ord1 (Clown f a) where + liftCompare = liftCompare2 compare +instance Ord1 f => Ord2 (Clown f) where + liftCompare2 f _ = compareClown (liftCompare f) + +instance (Read1 f, Read a) => Read1 (Clown f a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance Read1 f => Read2 (Clown f) where + liftReadsPrec2 rp1 rl1 _ _ = readsPrecClown (liftReadsPrec rp1 rl1) + +instance (Show1 f, Show a) => Show1 (Clown f a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance Show1 f => Show2 (Clown f) where + liftShowsPrec2 sp1 sl1 _ _ = showsPrecClown (liftShowsPrec sp1 sl1) +#else +instance (Eq1 f, Eq a) => Eq1 (Clown f a) where + eq1 = eqClown eq1 + +instance (Ord1 f, Ord a) => Ord1 (Clown f a) where + compare1 = compareClown compare1 + +instance (Read1 f, Read a) => Read1 (Clown f a) where + readsPrec1 = readsPrecClown readsPrec1 + +instance (Show1 f, Show a) => Show1 (Clown f a) where + showsPrec1 = showsPrecClown showsPrec1 +#endif + +eqClown :: (f a1 -> f a2 -> Bool) + -> Clown f a1 b1 -> Clown f a2 b2 -> Bool +eqClown eqA (Clown x) (Clown y) = eqA x y + +compareClown :: (f a1 -> f a2 -> Ordering) + -> Clown f a1 b1 -> Clown f a2 b2 -> Ordering +compareClown compareA (Clown x) (Clown y) = compareA x y + +readsPrecClown :: (Int -> ReadS (f a)) + -> Int -> ReadS (Clown f a b) +readsPrecClown rpA p = + readParen (p > 10) $ \s0 -> do + ("Clown", s1) <- lex s0 + ("{", s2) <- lex s1 + ("runClown", s3) <- lex s2 + (x, s4) <- rpA 0 s3 + ("}", s5) <- lex s4 + return (Clown x, s5) + +showsPrecClown :: (Int -> f a -> ShowS) + -> Int -> Clown f a b -> ShowS +showsPrecClown spA p (Clown x) = + showParen (p > 10) $ + showString "Clown {runClown = " + . spA 0 x + . showChar '}' + instance Functor f => Bifunctor (Clown f) where first f = Clown . fmap f . runClown {-# INLINE first #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Fix.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Fix.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Fix.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Fix.hs 2001-09-09 03:46:40.000000000 +0200 @@ -17,6 +17,7 @@ #if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -54,6 +55,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + -- | Greatest fixpoint of a 'Bifunctor' (a 'Functor' over the first argument with zipping). newtype Fix p a = In { out :: p (Fix p a) a } deriving @@ -71,6 +76,30 @@ deriving instance Show (p (Fix p a) a) => Show (Fix p a) deriving instance Read (p (Fix p a) a) => Read (Fix p a) +#if LIFTED_FUNCTOR_CLASSES +instance Eq2 p => Eq1 (Fix p) where + liftEq f (In x) (In y) = liftEq2 (liftEq f) f x y + +instance Ord2 p => Ord1 (Fix p) where + liftCompare f (In x) (In y) = liftCompare2 (liftCompare f) f x y + +instance Read2 p => Read1 (Fix p) where + liftReadsPrec rp1 rl1 p = readParen (p > 10) $ \s0 -> do + ("In", s1) <- lex s0 + ("{", s2) <- lex s1 + ("out", s3) <- lex s2 + (x, s4) <- liftReadsPrec2 (liftReadsPrec rp1 rl1) (liftReadList rp1 rl1) + rp1 rl1 0 s3 + ("}", s5) <- lex s4 + return (In x, s5) + +instance Show2 p => Show1 (Fix p) where + liftShowsPrec sp1 sl1 p (In x) = showParen (p > 10) $ + showString "In {out = " + . liftShowsPrec2 (liftShowsPrec sp1 sl1) (liftShowList sp1 sl1) + sp1 sl1 0 x + . showChar '}' +#endif instance Bifunctor p => Functor (Fix p) where fmap f (In p) = In (bimap (fmap f) f p) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Flip.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Flip.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Flip.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Flip.hs 2001-09-09 03:46:40.000000000 +0200 @@ -14,6 +14,7 @@ #if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -53,6 +54,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + -- | Make a 'Bifunctor' flipping the arguments of a 'Bifunctor'. newtype Flip p a b = Flip { runFlip :: p b a } deriving ( Eq, Ord, Show, Read @@ -64,6 +69,37 @@ #endif ) +#if LIFTED_FUNCTOR_CLASSES +instance (Eq2 p, Eq a) => Eq1 (Flip p a) where + liftEq = liftEq2 (==) +instance Eq2 p => Eq2 (Flip p) where + liftEq2 f g (Flip x) (Flip y) = liftEq2 g f x y + +instance (Ord2 p, Ord a) => Ord1 (Flip p a) where + liftCompare = liftCompare2 compare +instance Ord2 p => Ord2 (Flip p) where + liftCompare2 f g (Flip x) (Flip y) = liftCompare2 g f x y + +instance (Read2 p, Read a) => Read1 (Flip p a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance Read2 p => Read2 (Flip p) where + liftReadsPrec2 rp1 rl1 rp2 rl2 p = readParen (p > 10) $ \s0 -> do + ("Flip", s1) <- lex s0 + ("{", s2) <- lex s1 + ("runFlip", s3) <- lex s2 + (x, s4) <- liftReadsPrec2 rp2 rl2 rp1 rl1 0 s3 + ("}", s5) <- lex s4 + return (Flip x, s5) + +instance (Show2 p, Show a) => Show1 (Flip p a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance Show2 p => Show2 (Flip p) where + liftShowsPrec2 sp1 sl1 sp2 sl2 p (Flip x) = showParen (p > 10) $ + showString "Flip {runFlip = " + . liftShowsPrec2 sp2 sl2 sp1 sl1 0 x + . showChar '}' +#endif + instance Bifunctor p => Bifunctor (Flip p) where first f = Flip . second f . runFlip {-# INLINE first #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Join.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Join.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Join.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Join.hs 2001-09-09 03:46:40.000000000 +0200 @@ -17,6 +17,7 @@ #if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -53,6 +54,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + -- | Make a 'Functor' over both arguments of a 'Bifunctor'. newtype Join p a = Join { runJoin :: p a a } deriving @@ -70,6 +75,29 @@ deriving instance Show (p a a) => Show (Join p a) deriving instance Read (p a a) => Read (Join p a) +#if LIFTED_FUNCTOR_CLASSES +instance Eq2 p => Eq1 (Join p) where + liftEq f (Join x) (Join y) = liftEq2 f f x y + +instance Ord2 p => Ord1 (Join p) where + liftCompare f (Join x) (Join y) = liftCompare2 f f x y + +instance Read2 p => Read1 (Join p) where + liftReadsPrec rp1 rl1 p = readParen (p > 10) $ \s0 -> do + ("Join", s1) <- lex s0 + ("{", s2) <- lex s1 + ("runJoin", s3) <- lex s2 + (x, s4) <- liftReadsPrec2 rp1 rl1 rp1 rl1 0 s3 + ("}", s5) <- lex s4 + return (Join x, s5) + +instance Show2 p => Show1 (Join p) where + liftShowsPrec sp1 sl1 p (Join x) = showParen (p > 10) $ + showString "Join {runJoin = " + . liftShowsPrec2 sp1 sl1 sp1 sl1 0 x + . showChar '}' +#endif + instance Bifunctor p => Functor (Join p) where fmap f (Join a) = Join (bimap f f a) {-# INLINE fmap #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Joker.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Joker.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Joker.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Joker.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,6 +16,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -40,6 +41,7 @@ import Data.Biapplicative import Data.Bifoldable import Data.Bitraversable +import Data.Functor.Classes #if __GLASGOW_HASKELL__ < 710 import Data.Foldable @@ -92,6 +94,67 @@ to1 = Joker . unRec1 . unM1 . unM1 . unM1 #endif +#if LIFTED_FUNCTOR_CLASSES +instance Eq1 g => Eq1 (Joker g a) where + liftEq g = eqJoker (liftEq g) +instance Eq1 g => Eq2 (Joker g) where + liftEq2 _ g = eqJoker (liftEq g) + +instance Ord1 g => Ord1 (Joker g a) where + liftCompare g = compareJoker (liftCompare g) +instance Ord1 g => Ord2 (Joker g) where + liftCompare2 _ g = compareJoker (liftCompare g) + +instance Read1 g => Read1 (Joker g a) where + liftReadsPrec rp rl = readsPrecJoker (liftReadsPrec rp rl) +instance Read1 g => Read2 (Joker g) where + liftReadsPrec2 _ _ rp2 rl2 = readsPrecJoker (liftReadsPrec rp2 rl2) + +instance Show1 g => Show1 (Joker g a) where + liftShowsPrec sp sl = showsPrecJoker (liftShowsPrec sp sl) +instance Show1 g => Show2 (Joker g) where + liftShowsPrec2 _ _ sp2 sl2 = showsPrecJoker (liftShowsPrec sp2 sl2) +#else +instance Eq1 g => Eq1 (Joker g a) where + eq1 = eqJoker eq1 + +instance Ord1 g => Ord1 (Joker g a) where + compare1 = compareJoker compare1 + +instance Read1 g => Read1 (Joker g a) where + readsPrec1 = readsPrecJoker readsPrec1 + +instance Show1 g => Show1 (Joker g a) where + showsPrec1 = showsPrecJoker showsPrec1 +#endif + +eqJoker :: (g b1 -> g b2 -> Bool) + -> Joker g a1 b1 -> Joker g a2 b2 -> Bool +eqJoker eqB (Joker x) (Joker y) = eqB x y + +compareJoker :: (g b1 -> g b2 -> Ordering) + -> Joker g a1 b1 -> Joker g a2 b2 -> Ordering +compareJoker compareB (Joker x) (Joker y) = compareB x y + +readsPrecJoker :: (Int -> ReadS (g b)) + -> Int -> ReadS (Joker g a b) +readsPrecJoker rpB p = + readParen (p > 10) $ \s0 -> do + ("Joker", s1) <- lex s0 + ("{", s2) <- lex s1 + ("runJoker", s3) <- lex s2 + (x, s4) <- rpB 0 s3 + ("}", s5) <- lex s4 + return (Joker x, s5) + +showsPrecJoker :: (Int -> g b -> ShowS) + -> Int -> Joker g a b -> ShowS +showsPrecJoker spB p (Joker x) = + showParen (p > 10) $ + showString "Joker {runJoker = " + . spB 0 x + . showChar '}' + instance Functor g => Bifunctor (Joker g) where first _ = Joker . runJoker {-# INLINE first #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Product.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Product.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Product.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Product.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,6 +16,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -53,6 +54,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + -- | Form the product of two bifunctors data Product f g a b = Pair (f a b) (g a b) deriving ( Eq, Ord, Show, Read @@ -84,6 +89,36 @@ to1 (M1 (M1 (M1 f :*: M1 g))) = Pair (unRec1 f) (unRec1 g) #endif +#if LIFTED_FUNCTOR_CLASSES +instance (Eq2 f, Eq2 g, Eq a) => Eq1 (Product f g a) where + liftEq = liftEq2 (==) +instance (Eq2 f, Eq2 g) => Eq2 (Product f g) where + liftEq2 f g (Pair x1 y1) (Pair x2 y2) = + liftEq2 f g x1 x2 && liftEq2 f g y1 y2 + +instance (Ord2 f, Ord2 g, Ord a) => Ord1 (Product f g a) where + liftCompare = liftCompare2 compare +instance (Ord2 f, Ord2 g) => Ord2 (Product f g) where + liftCompare2 f g (Pair x1 y1) (Pair x2 y2) = + liftCompare2 f g x1 x2 `mappend` liftCompare2 f g y1 y2 + +instance (Read2 f, Read2 g, Read a) => Read1 (Product f g a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance (Read2 f, Read2 g) => Read2 (Product f g) where + liftReadsPrec2 rp1 rl1 rp2 rl2 = readsData $ + readsBinaryWith (liftReadsPrec2 rp1 rl1 rp2 rl2) + (liftReadsPrec2 rp1 rl1 rp2 rl2) + "Pair" Pair + +instance (Show2 f, Show2 g, Show a) => Show1 (Product f g a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance (Show2 f, Show2 g) => Show2 (Product f g) where + liftShowsPrec2 sp1 sl1 sp2 sl2 p (Pair x y) = + showsBinaryWith (liftShowsPrec2 sp1 sl1 sp2 sl2) + (liftShowsPrec2 sp1 sl1 sp2 sl2) + "Pair" p x y +#endif + instance (Bifunctor f, Bifunctor g) => Bifunctor (Product f g) where first f (Pair x y) = Pair (first f x) (first f y) {-# INLINE first #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Sum.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Sum.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Sum.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Sum.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,6 +16,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" module Data.Bifunctor.Sum where @@ -23,8 +24,10 @@ import Data.Bifunctor.Functor import Data.Bifoldable import Data.Bitraversable + #if __GLASGOW_HASKELL__ < 710 import Data.Functor +import Data.Monoid hiding (Sum) #endif #if __GLASGOW_HASKELL__ >= 708 import Data.Typeable @@ -32,6 +35,9 @@ #if __GLASGOW_HASKELL__ >= 702 import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif data Sum p q a b = L2 (p a b) | R2 (q a b) deriving ( Eq, Ord, Show, Read @@ -69,6 +75,39 @@ to1 (M1 (R1 (M1 (M1 q)))) = R2 (unRec1 q) #endif +#if LIFTED_FUNCTOR_CLASSES +instance (Eq2 f, Eq2 g, Eq a) => Eq1 (Sum f g a) where + liftEq = liftEq2 (==) +instance (Eq2 f, Eq2 g) => Eq2 (Sum f g) where + liftEq2 f g (L2 x1) (L2 x2) = liftEq2 f g x1 x2 + liftEq2 _ _ (L2 _) (R2 _) = False + liftEq2 _ _ (R2 _) (L2 _) = False + liftEq2 f g (R2 y1) (R2 y2) = liftEq2 f g y1 y2 + +instance (Ord2 f, Ord2 g, Ord a) => Ord1 (Sum f g a) where + liftCompare = liftCompare2 compare +instance (Ord2 f, Ord2 g) => Ord2 (Sum f g) where + liftCompare2 f g (L2 x1) (L2 x2) = liftCompare2 f g x1 x2 + liftCompare2 _ _ (L2 _) (R2 _) = LT + liftCompare2 _ _ (R2 _) (L2 _) = GT + liftCompare2 f g (R2 y1) (R2 y2) = liftCompare2 f g y1 y2 + +instance (Read2 f, Read2 g, Read a) => Read1 (Sum f g a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance (Read2 f, Read2 g) => Read2 (Sum f g) where + liftReadsPrec2 rp1 rl1 rp2 rl2 = readsData $ + readsUnaryWith (liftReadsPrec2 rp1 rl1 rp2 rl2) "L2" L2 `mappend` + readsUnaryWith (liftReadsPrec2 rp1 rl1 rp2 rl2) "R2" R2 + +instance (Show2 f, Show2 g, Show a) => Show1 (Sum f g a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance (Show2 f, Show2 g) => Show2 (Sum f g) where + liftShowsPrec2 sp1 sl1 sp2 sl2 p (L2 x) = + showsUnaryWith (liftShowsPrec2 sp1 sl1 sp2 sl2) "L2" p x + liftShowsPrec2 sp1 sl1 sp2 sl2 p (R2 y) = + showsUnaryWith (liftShowsPrec2 sp1 sl1 sp2 sl2) "R2" p y +#endif + instance (Bifunctor p, Bifunctor q) => Bifunctor (Sum p q) where bimap f g (L2 p) = L2 (bimap f g p) bimap f g (R2 q) = R2 (bimap f g q) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/TH.hs new/bifunctors-5.5.5/src/Data/Bifunctor/TH.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/TH.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/TH.hs 2001-09-09 03:46:40.000000000 +0200 @@ -352,11 +352,7 @@ case info of DatatypeInfo { datatypeContext = ctxt , datatypeName = parentName -#if MIN_VERSION_th_abstraction(0,3,0) , datatypeInstTypes = instTys -#else - , datatypeVars = instTys -#endif , datatypeVariant = variant , datatypeCons = cons } -> do @@ -390,11 +386,7 @@ case info of DatatypeInfo { datatypeContext = ctxt , datatypeName = parentName -#if MIN_VERSION_th_abstraction(0,3,0) , datatypeInstTypes = instTys -#else - , datatypeVars = instTys -#endif , datatypeVariant = variant , datatypeCons = cons } -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Tannen.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Tannen.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Tannen.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Tannen.hs 2001-09-09 03:46:40.000000000 +0200 @@ -19,6 +19,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -60,6 +61,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + import Prelude hiding ((.),id) -- | Compose a 'Functor' on the outside of a 'Bifunctor'. @@ -99,6 +104,39 @@ # endif #endif +#if LIFTED_FUNCTOR_CLASSES +instance (Eq1 f, Eq2 p, Eq a) => Eq1 (Tannen f p a) where + liftEq = liftEq2 (==) +instance (Eq1 f, Eq2 p) => Eq2 (Tannen f p) where + liftEq2 f g (Tannen x) (Tannen y) = liftEq (liftEq2 f g) x y + +instance (Ord1 f, Ord2 p, Ord a) => Ord1 (Tannen f p a) where + liftCompare = liftCompare2 compare +instance (Ord1 f, Ord2 p) => Ord2 (Tannen f p) where + liftCompare2 f g (Tannen x) (Tannen y) = liftCompare (liftCompare2 f g) x y + +instance (Read1 f, Read2 p, Read a) => Read1 (Tannen f p a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance (Read1 f, Read2 p) => Read2 (Tannen f p) where + liftReadsPrec2 rp1 rl1 rp2 rl2 p = readParen (p > 10) $ \s0 -> do + ("Tannen", s1) <- lex s0 + ("{", s2) <- lex s1 + ("runTannen", s3) <- lex s2 + (x, s4) <- liftReadsPrec (liftReadsPrec2 rp1 rl1 rp2 rl2) + (liftReadList2 rp1 rl1 rp2 rl2) 0 s3 + ("}", s5) <- lex s4 + return (Tannen x, s5) + +instance (Show1 f, Show2 p, Show a) => Show1 (Tannen f p a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance (Show1 f, Show2 p) => Show2 (Tannen f p) where + liftShowsPrec2 sp1 sl1 sp2 sl2 p (Tannen x) = showParen (p > 10) $ + showString "Tannen {runTannen = " + . liftShowsPrec (liftShowsPrec2 sp1 sl1 sp2 sl2) + (liftShowList2 sp1 sl1 sp2 sl2) 0 x + . showChar '}' +#endif + instance Functor f => BifunctorFunctor (Tannen f) where bifmap f (Tannen fp) = Tannen (fmap f fp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bifunctors-5.5.4/src/Data/Bifunctor/Wrapped.hs new/bifunctors-5.5.5/src/Data/Bifunctor/Wrapped.hs --- old/bifunctors-5.5.4/src/Data/Bifunctor/Wrapped.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/bifunctors-5.5.5/src/Data/Bifunctor/Wrapped.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,6 +16,7 @@ #elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif +#include "bifunctors-common.h" ----------------------------------------------------------------------------- -- | @@ -53,6 +54,10 @@ import GHC.Generics #endif +#if LIFTED_FUNCTOR_CLASSES +import Data.Functor.Classes +#endif + -- | Make a 'Functor' over the second argument of a 'Bifunctor'. newtype WrappedBifunctor p a b = WrapBifunctor { unwrapBifunctor :: p a b } deriving ( Eq, Ord, Show, Read @@ -89,6 +94,37 @@ to1 = WrapBifunctor . unRec1 . unM1 . unM1 . unM1 #endif +#if LIFTED_FUNCTOR_CLASSES +instance (Eq2 p, Eq a) => Eq1 (WrappedBifunctor p a) where + liftEq = liftEq2 (==) +instance Eq2 p => Eq2 (WrappedBifunctor p) where + liftEq2 f g (WrapBifunctor x) (WrapBifunctor y) = liftEq2 f g x y + +instance (Ord2 p, Ord a) => Ord1 (WrappedBifunctor p a) where + liftCompare = liftCompare2 compare +instance Ord2 p => Ord2 (WrappedBifunctor p) where + liftCompare2 f g (WrapBifunctor x) (WrapBifunctor y) = liftCompare2 f g x y + +instance (Read2 p, Read a) => Read1 (WrappedBifunctor p a) where + liftReadsPrec = liftReadsPrec2 readsPrec readList +instance Read2 p => Read2 (WrappedBifunctor p) where + liftReadsPrec2 rp1 rl1 rp2 rl2 p = readParen (p > 10) $ \s0 -> do + ("WrapBifunctor", s1) <- lex s0 + ("{", s2) <- lex s1 + ("unwrapBifunctor", s3) <- lex s2 + (x, s4) <- liftReadsPrec2 rp1 rl1 rp2 rl2 0 s3 + ("}", s5) <- lex s4 + return (WrapBifunctor x, s5) + +instance (Show2 p, Show a) => Show1 (WrappedBifunctor p a) where + liftShowsPrec = liftShowsPrec2 showsPrec showList +instance Show2 p => Show2 (WrappedBifunctor p) where + liftShowsPrec2 sp1 sl1 sp2 sl2 p (WrapBifunctor x) = showParen (p > 10) $ + showString "WrapBifunctor {unwrapBifunctor = " + . liftShowsPrec2 sp1 sl1 sp2 sl2 0 x + . showChar '}' +#endif + instance Bifunctor p => Bifunctor (WrappedBifunctor p) where first f = WrapBifunctor . first f . unwrapBifunctor {-# INLINE first #-}
