packages feed

distributive 0.5.3 → 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,144 +0,0 @@-# This file has been generated -- see https://github.com/hvr/multi-ghc-travis-language: c-sudo: false--cache:-  directories:-    - $HOME/.cabsnap-    - $HOME/.cabal/packages-    - $HOME/.stack--before_cache:-  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log-  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar--matrix:-  include:-    - env: CABALVER=1.24 GHCVER=7.0.4 BUILD=cabal-      compiler: ": #GHC 7.0.4"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.0.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=1.24 GHCVER=7.2.2 BUILD=cabal-      compiler: ": #GHC 7.2.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.2.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=1.24 GHCVER=7.4.2 BUILD=cabal-      compiler: ": #GHC 7.4.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=1.24 GHCVER=7.6.3 BUILD=cabal-      compiler: ": #GHC 7.6.3"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=1.24 GHCVER=7.8.4 BUILD=cabal-      compiler: ": #GHC 7.8.4"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--#    - env: BUILD=stack STACK_YAML=stack-7.8.yaml STACK_OPTIONS=--skip-ghc-check-#      addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--#    - env: BUILD=stack STACK_YAML=stack-7.8.yaml-#      os: osx--    - env: CABALVER=1.24 GHCVER=7.10.3 BUILD=cabal-      compiler: ": #GHC 7.10.3"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=1.24 GHCVER=8.0.2 BUILD=cabal-      compiler: ": #GHC 8.0.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=2.0 GHCVER=8.2.1 BUILD=cabal-      compiler: ": #GHC 8.2.1"-      addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--    - env: CABALVER=1.24 GHCVER=head BUILD=cabal CABALFLAGS=--allow-newer-      compiler: ": #GHC head"-      addons: {apt: {packages: [cabal-install-1.24,ghc-head,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--#    - env: BUILD=stack STACK_OPTIONS=--skip-ghc-check-#      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}--#    - env: BUILD=stack-#      os: osx--  allow_failures:-    - env: CABALVER=1.24 GHCVER=7.0.4 BUILD=cabal-    - env: CABALVER=1.24 GHCVER=7.2.2 BUILD=cabal-    - env: CABALVER=1.24 GHCVER=head BUILD=cabal CABALFLAGS=--allow-newer--before_install:- - unset CC- - case "$BUILD" in-     stack)-       export STACK_VERSION=0.1.3.0;-       export PATH=~/bin:$PATH;-       mkdir -p ~/bin;-       travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-x86_64-$TRAVIS_OS_NAME.gz | gunzip > ~/bin/stack;-       chmod a+x ~/bin/stack;-       scripts/travis_long stack --no-terminal setup;;-     cabal)-       export HAPPYVER=1.19.5-       export ALEXVER=3.1.4-       export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH;;-   esac-install:- - case "$BUILD" in-     stack)-       scripts/travis_long stack --no-terminal $STACK_OPTIONS build --only-snapshot -j2;;-     cabal)-       echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"-       cabal --version;-       if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];-       then-         zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >-              $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;-       fi;-       travis_retry cabal update;-       cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v $CABALFLAGS> installplan.txt;-       sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt;-       if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; then-         echo "cabal build-cache HIT";-         rm -rfv .ghc;-         cp -a $HOME/.cabsnap/ghc $HOME/.ghc;-         cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;-       else-         echo "cabal build-cache MISS";-         rm -rf $HOME/.cabsnap;-         mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;-         cabal install --only-dependencies --enable-tests --enable-benchmarks $CABALFLAGS;-       fi;-       if [ ! -d $HOME/.cabsnap ]; then-         echo "snapshotting package-db to build-cache";-         mkdir $HOME/.cabsnap;-         cp -a $HOME/.ghc $HOME/.cabsnap/ghc;-         cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;-       fi;;-   esac--# snapshot package-db on cache miss--# 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:- - case "$BUILD" in-     stack)-       scripts/travis_long stack --no-terminal $STACK_OPTIONS build -j2;;-     cabal)-       cabal configure --enable-tests -v2 $CABALFLAGS;-       cabal build;-       cabal test --show-details=always;-       cabal bench || true;-       cabal sdist || true;-       SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz;-       if [ -f $SRC_TGZ ]; then (cd dist && cabal install --force-reinstalls "$SRC_TGZ"); fi;-   esac--notifications:-  irc:-    channels:-      - "irc.freenode.org#haskell-lens"-    skip_join: true-    template:-      - "\x0313distributive\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f"-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,30 @@+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+  [here](https://github.com/ekmett/distributive/commit/1020655f15714514048d0dc842ffe4adcec89a7b)+  for an explanation of why it was removed.)+* Avoid incurring some dependencies when using recent GHCs.+ 0.5.3 ----- * Support `doctest-0.12`
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.5.3+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>@@ -11,34 +11,32 @@ bug-reports:   http://github.com/ekmett/distributive/issues copyright:     Copyright (C) 2011-2016 Edward A. Kmett synopsis:      Distributive functors -- Dual to Traversable-description:   Distributive functors -- Dual to Traversable-build-type:    Custom+description:   Distributive functors -- Dual to @Traversable@+build-type:    Simple+tested-with:   GHC == 8.0.2+             , GHC == 8.2.2+             , 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@@ -50,48 +48,31 @@  library   build-depends:-    base                >= 4   && < 5,-    base-orphans        >= 0.5 && < 1,-    transformers        >= 0.2 && < 0.6,-    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.11 && < 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.13-  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+  build-tool-depends:+    hspec-discover:hspec-discover    build-depends:     base             >= 4    && < 5,@@ -103,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 #-}  ----------------------------------------------------------------------------- -- |@@ -21,40 +20,27 @@   ( Distributive(..)   , cotraverse   , comapM-  , fmapCollect   ) where  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" #-}@@ -67,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@@ -76,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@@ -137,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@@ -151,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@@ -206,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@@ -230,23 +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 --- | 'fmapCollect' is a viable default definition for 'fmap' given--- a 'Distributive' instance defined in terms of 'collect'.-fmapCollect :: forall f a b . Distributive f => (a -> b) -> f a -> f b-fmapCollect = coerce (collect :: (a -> Identity b) -> f a -> Identity (f b))+instance (Distributive m, Monad m) => Distributive (WrappedMonad m) where+  collect f = WrapMonad . collect (coerce f) -#if __GLASGOW_HASKELL__ >= 702 instance Distributive U1 where   distribute _ = U1 @@ -279,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 "$@"