packages feed

distributive 0.6 → 0.6.3

raw patch · 12 files changed

Files

+ .hlint.yaml view
@@ -0,0 +1,3 @@+- arguments: [--cpp-define=HLINT, --cpp-ansi]++- ignore: {name: Use section}
− .travis.yml
@@ -1,159 +0,0 @@-# 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'-#-# For more information, see https://github.com/hvr/multi-ghc-travis-#-language: c-sudo: false--git:-  submodules: false  # whether to recursively clone submodules--notifications:-  irc:-    channels:-      - "irc.freenode.org#haskell-lens"-    skip_join: true-    template:-      - "\x0313distributive\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-  # 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--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]}}--  allow_failures:-    - compiler: "ghc-head"-    - compiler: "ghc-7.0.4"-    - compiler: "ghc-7.2.2"-    - compiler: "ghc-8.6.1"--before_install:-  - HC=${CC}-  - HCPKG=${HC/ghc/ghc-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/') ))-  - echo $HCNUMVER--install:-  - 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-  # 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-    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 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.-script:-  # test that source-distributions can be generated-  - (cd "." && cabal sdist)-  - mv "."/dist/distributive-*.tar.gz ${DISTDIR}/-  - cd ${DISTDIR} || false-  - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;-  - "printf 'packages: distributive-*/*.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"-  - cat cabal.project || true-  - cat cabal.project.local || true--  # 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 distributive-* && cabal check)--  # haddock-  - rm -rf ./dist-newstyle-  - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi--# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"]-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,23 @@+0.6.3 [2026.01.10]+------------------+* Drop support for pre-8.0 versions of GHC.+* Drop unnecessary `base-orphans` dependency.++0.6.2.1 [2020.12.30]+--------------------+* The build-type has been changed from `Custom` to `Simple`.+  To achieve this, the `doctests` test suite has been removed in favor of using+  [`cabal-docspec`](https://github.com/phadej/cabal-extras/tree/master/cabal-docspec)+  to run the doctests.++0.6.2 [2020.04.10]+------------------+* Make the `Distributive` instance for `Tagged` poly-kinded.++0.6.1 [2019.09.06]+------------------+* Add a `Distributive` instance for `WrappedMonad m`.+ 0.6 [2018.07.02] ---------------- * Remove `fmapCollect`. (See
README.markdown view
@@ -1,7 +1,8 @@ distributive ============ -[![Hackage](https://img.shields.io/hackage/v/distributive.svg)](https://hackage.haskell.org/package/distributive) [![Build Status](https://secure.travis-ci.org/ekmett/distributive.png?branch=master)](http://travis-ci.org/ekmett/distributive)++[![Hackage](https://img.shields.io/hackage/v/distributive.svg)](https://hackage.haskell.org/package/distributive) [![Build Status](https://github.com/ekmett/distributive/workflows/Haskell-CI/badge.svg)](https://github.com/ekmett/distributive/actions?query=workflow%3AHaskell-CI)  This package provides the notion that is categorically dual to `Traversable`. 
Setup.lhs view
@@ -1,34 +1,5 @@ \begin{code}-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "doctests"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-import Warning ()-#endif--import Distribution.Simple-+import Distribution.Simple (defaultMain) main :: IO () main = defaultMain--#endif- \end{code}
− Warning.hs
@@ -1,5 +0,0 @@-module Warning-  {-# WARNING ["You are configuring this package without cabal-doctest installed.",-               "The doctests test-suite will not work as a result.",-               "To fix this, install cabal-doctest before configuring."] #-}-  () where
distributive.cabal view
@@ -1,8 +1,8 @@ name:          distributive category:      Data Structures-version:       0.6+version:       0.6.3 license:       BSD3-cabal-version: >= 1.8+cabal-version: >= 1.10 license-file:  LICENSE author:        Edward A. Kmett maintainer:    Edward A. Kmett <ekmett@gmail.com>@@ -12,43 +12,31 @@ copyright:     Copyright (C) 2011-2016 Edward A. Kmett synopsis:      Distributive functors -- Dual to Traversable description:   Distributive functors -- Dual to @Traversable@-build-type:    Custom-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-             , GHC == 8.0.2+build-type:    Simple+tested-with:   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.4+             , GHC == 8.10.4+             , GHC == 9.0.2+             , GHC == 9.2.8+             , GHC == 9.4.8+             , GHC == 9.6.7+             , GHC == 9.8.4+             , GHC == 9.10.3+             , GHC == 9.12.2+             , GHC == 9.14.1 extra-source-files:-  .travis.yml+  .hlint.yaml   .vim.custom   config-  travis-cabal-apt-install   CHANGELOG.markdown   README.markdown-  Warning.hs  source-repository head   type: git-  location: git://github.com/ekmett/distributive.git--custom-setup-  setup-depends:-    base >= 4 && <5,-    Cabal,-    cabal-doctest >= 1 && <1.1--flag semigroups-  manual: True-  default: True-  description:-    You can disable the use of the `semigroups` package using `-f-semigroups`.-    .-    Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+  location: https://github.com/ekmett/distributive.git  flag tagged   manual: True@@ -60,47 +48,26 @@  library   build-depends:-    base                >= 4   && < 5,-    base-orphans        >= 0.5.2 && < 1,-    transformers        >= 0.2 && < 0.6--  if !impl(ghc >= 7.8) && !impl(ghcjs)-    build-depends: transformers-compat >= 0.3 && < 1+    base                >= 4.9 && < 5,+    transformers        >= 0.3 && < 0.7    hs-source-dirs:  src   exposed-modules:     Data.Distributive--  if impl(ghc>=7.2)-    exposed-modules: Data.Distributive.Generic+    Data.Distributive.Generic    if flag(tagged)     build-depends: tagged >= 0.7 && < 1 -  if impl(ghc>=7.2 && < 7.6)-    build-depends: ghc-prim--  if impl(ghc < 8.0)-    if flag(semigroups)-      build-depends: semigroups >= 0.13 && < 1--  if impl(ghc < 7.8)-    hs-source-dirs: src-compat-    other-modules: Data.Coerce-   ghc-options: -Wall --- Verify the results of the examples-test-suite doctests-  type:    exitcode-stdio-1.0-  main-is: doctests.hs-  build-depends:-    base      >= 4,-    distributive,-    doctest   >= 0.11.1 && <0.17-  ghc-options: -Wall -threaded-  hs-source-dirs: tests+  if impl(ghc >= 9.0)+    -- these flags may abort compilation with GHC-8.10+    -- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295+    ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode +  default-language: Haskell2010+ test-suite spec   type:           exitcode-stdio-1.0   hs-source-dirs: tests@@ -117,3 +84,4 @@   other-modules: GenericsSpec    ghc-options: -Wall -threaded -rtsopts+  default-language: Haskell2010
− src-compat/Data/Coerce.hs
@@ -1,8 +0,0 @@--- This is a shim for GHC before 7.8. Cabal ignores it--- for GHC 7.8 and later.-module Data.Coerce (coerce) where--import Unsafe.Coerce (unsafeCoerce)--coerce :: a -> b-coerce = unsafeCoerce
src/Data/Distributive.hs view
@@ -2,9 +2,8 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE ScopedTypeVariables #-}-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE PolyKinds #-}  ----------------------------------------------------------------------------- -- |@@ -26,34 +25,22 @@ import Control.Applicative import Control.Applicative.Backwards import Control.Monad (liftM)-#if __GLASGOW_HASKELL__ < 707-import Control.Monad.Instances ()-#endif import Control.Monad.Trans.Identity import Control.Monad.Trans.Reader import Data.Coerce+import Data.Complex import Data.Functor.Compose import Data.Functor.Identity import Data.Functor.Product import Data.Functor.Reverse import qualified Data.Monoid as Monoid-import Data.Orphans ()--#if MIN_VERSION_base(4,4,0)-import Data.Complex-#endif-#if __GLASGOW_HASKELL__ >= 707 || defined(MIN_VERSION_tagged) import Data.Proxy-#endif-#if __GLASGOW_HASKELL__ >= 800 || defined(MIN_VERSION_semigroups) import qualified Data.Semigroup as Semigroup-#endif+import GHC.Generics (U1(..), (:*:)(..), (:.:)(..), Par1(..), Rec1(..), M1(..))+ #ifdef MIN_VERSION_tagged import Data.Tagged #endif-#if __GLASGOW_HASKELL__ >= 702-import GHC.Generics (U1(..), (:*:)(..), (:.:)(..), Par1(..), Rec1(..), M1(..))-#endif  #ifdef HLINT {-# ANN module "hlint: ignore Use section" #-}@@ -66,7 +53,7 @@ -- some Coapplicative class. Categorically every 'Distributive' -- functor is actually a right adjoint, and so it must be 'Representable' -- endofunctor and preserve all limits. This is a fancy way of saying it--- isomorphic to @(->) x@ for some x.+-- is isomorphic to @(->) x@ for some x. -- -- To be distributable a container will need to have a way to consistently -- zip a potentially infinite number of copies of itself. This effectively@@ -75,9 +62,7 @@ -- and no extra information to try to merge together. -- class Functor g => Distributive g where-#if __GLASGOW_HASKELL__ >= 707   {-# MINIMAL distribute | collect #-}-#endif   -- | The dual of 'Data.Traversable.sequenceA'   --   -- >>> distribute [(+1),(+2)] 1@@ -136,11 +121,9 @@     :: forall a b f . Functor f => (a -> Identity b) -> f a -> Identity (f b)   distribute = Identity . fmap runIdentity -#if __GLASGOW_HASKELL__ >= 707 || defined(MIN_VERSION_tagged) instance Distributive Proxy where   collect _ _ = Proxy   distribute _ = Proxy-#endif  #if defined(MIN_VERSION_tagged) instance Distributive (Tagged t) where@@ -150,7 +133,7 @@ #endif  instance Distributive ((->)e) where-  distribute a e = fmap ($e) a+  distribute a e = fmap ($ e) a   collect f q e = fmap (flip f e) q  instance Distributive g => Distributive (ReaderT e g) where@@ -205,7 +188,6 @@     => (a -> Monoid.Sum b) -> f a -> Monoid.Sum (f b)   distribute = Monoid.Sum . fmap Monoid.getSum -#if __GLASGOW_HASKELL__ >= 800 || defined(MIN_VERSION_semigroups) instance Distributive Semigroup.Min where   collect = coerce (fmap :: (a -> b) -> f a -> f b)     :: forall f a b . Functor f@@ -229,18 +211,17 @@     :: forall f a b . Functor f     => (a -> Semigroup.Last b) -> f a -> Semigroup.Last (f b)   distribute = Semigroup.Last . fmap Semigroup.getLast-#endif -#if MIN_VERSION_base(4,4,0) instance Distributive Complex where   distribute wc = fmap realP wc :+ fmap imagP wc where     -- Redefine realPart and imagPart to avoid incurring redundant RealFloat     -- constraints on older versions of base     realP (r :+ _) = r     imagP (_ :+ i) = i-#endif -#if __GLASGOW_HASKELL__ >= 702+instance (Distributive m, Monad m) => Distributive (WrappedMonad m) where+  collect f = WrapMonad . collect (coerce f)+ instance Distributive U1 where   distribute _ = U1 @@ -273,4 +254,3 @@   collect = coerce (collect :: (a -> f b) -> g a -> f (g b))     :: forall g a b . Functor g     => (a -> M1 i c f b) -> g a -> M1 i c f (g b)-#endif
src/Data/Distributive/Generic.hs view
@@ -1,10 +1,7 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-}-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module      :  Data.Distributive
− tests/doctests.hs
@@ -1,25 +0,0 @@--------------------------------------------------------------------------------- |--- Module      :  Main (doctests)--- Copyright   :  (C) 2012-14 Edward Kmett--- License     :  BSD-style (see the file LICENSE)--- Maintainer  :  Edward Kmett <ekmett@gmail.com>--- Stability   :  provisional--- Portability :  portable------ This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project-------------------------------------------------------------------------------module Main where--import Build_doctests (flags, pkgs, module_sources)-import Data.Foldable (traverse_)-import Test.DocTest--main :: IO ()-main = do-    traverse_ putStrLn args-    doctest args-  where-    args = flags ++ pkgs ++ module_sources
− travis-cabal-apt-install
@@ -1,16 +0,0 @@-#!/bin/sh-set -eu--sudo apt-get -q update-sudo apt-get -q -y install dctrl-tools--# Try installing some of the build-deps with apt-get for speed.-eval "$(-  printf '%s' "grep-aptavail -n -sPackage '(' -FFALSE -X FALSE ')'"-  2>/dev/null cabal install "$@" --dry-run -v | \-  sed -nre "s/^([^ ]+)-[0-9.]+ \(.*$/ -o '(' -FPackage -X libghc-\1-dev ')'/p" | \-  xargs -d'\n'-)" | sort -u | xargs -d'\n' sudo apt-get -q -y install -- libghc-quickcheck2-dev--# Install whatever is still needed with cabal.-cabal install "$@"