adjunctions 4.4 → 4.4.1
raw patch · 11 files changed
+40/−206 lines, 11 filesdep ~mtldep ~transformersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: mtl, transformers
API changes (from Hackage documentation)
- Control.Comonad.Representable.Store: instance (Control.Comonad.Comonad w, Data.Functor.Rep.Representable g, Data.Functor.Rep.Rep g ~ s) => Control.Comonad.Store.Class.ComonadStore s (Control.Comonad.Representable.Store.StoreT g w)
- Control.Comonad.Representable.Store: instance (Control.Comonad.ComonadApply w, Data.Semigroup.Semigroup (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => Control.Comonad.ComonadApply (Control.Comonad.Representable.Store.StoreT g w)
- Control.Comonad.Representable.Store: instance (Data.Functor.Bind.Class.Apply w, Data.Semigroup.Semigroup (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => Data.Functor.Bind.Class.Apply (Control.Comonad.Representable.Store.StoreT g w)
- Control.Monad.Representable.Reader: instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable m, Data.Semigroup.Semigroup (Data.Functor.Rep.Rep f), Data.Semigroup.Semigroup (Data.Functor.Rep.Rep m)) => Data.Functor.Extend.Extend (Control.Monad.Representable.Reader.ReaderT f m)
- Control.Monad.Representable.State: instance (Data.Functor.Rep.Representable g, GHC.Base.Monad m, Data.Functor.Rep.Rep g ~ s) => Control.Monad.State.Class.MonadState s (Control.Monad.Representable.State.StateT g m)
- Data.Functor.Rep: instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Rep f ~ a) => Control.Monad.Reader.Class.MonadReader a (Data.Functor.Rep.Co f)
- Data.Functor.Rep: instance (Data.Functor.Rep.Representable f, Data.Semigroup.Semigroup (Data.Functor.Rep.Rep f)) => Data.Functor.Extend.Extend (Data.Functor.Rep.Co f)
- Data.Functor.Rep: instance Data.Functor.Rep.Representable Data.Monoid.Dual
- Data.Functor.Rep: instance Data.Functor.Rep.Representable Data.Monoid.Product
- Data.Functor.Rep: instance Data.Functor.Rep.Representable Data.Monoid.Sum
+ Control.Comonad.Representable.Store: instance (Control.Comonad.Comonad w, Data.Functor.Rep.Representable g, Data.Functor.Rep.Rep g GHC.Types.~ s) => Control.Comonad.Store.Class.ComonadStore s (Control.Comonad.Representable.Store.StoreT g w)
+ Control.Comonad.Representable.Store: instance (Control.Comonad.ComonadApply w, GHC.Base.Semigroup (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => Control.Comonad.ComonadApply (Control.Comonad.Representable.Store.StoreT g w)
+ Control.Comonad.Representable.Store: instance (Data.Functor.Bind.Class.Apply w, GHC.Base.Semigroup (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => Data.Functor.Bind.Class.Apply (Control.Comonad.Representable.Store.StoreT g w)
+ Control.Monad.Representable.Reader: instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable m, GHC.Base.Semigroup (Data.Functor.Rep.Rep f), GHC.Base.Semigroup (Data.Functor.Rep.Rep m)) => Data.Functor.Extend.Extend (Control.Monad.Representable.Reader.ReaderT f m)
+ Control.Monad.Representable.State: instance (Data.Functor.Rep.Representable g, GHC.Base.Monad m, Data.Functor.Rep.Rep g GHC.Types.~ s) => Control.Monad.State.Class.MonadState s (Control.Monad.Representable.State.StateT g m)
+ Data.Functor.Rep: -- | If no definition is provided, this will default to <a>GRep</a>.
+ Data.Functor.Rep: instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Rep f GHC.Types.~ a) => Control.Monad.Reader.Class.MonadReader a (Data.Functor.Rep.Co f)
+ Data.Functor.Rep: instance (Data.Functor.Rep.Representable f, GHC.Base.Semigroup (Data.Functor.Rep.Rep f)) => Data.Functor.Extend.Extend (Data.Functor.Rep.Co f)
+ Data.Functor.Rep: instance Data.Functor.Rep.Representable Data.Semigroup.Internal.Dual
+ Data.Functor.Rep: instance Data.Functor.Rep.Representable Data.Semigroup.Internal.Product
+ Data.Functor.Rep: instance Data.Functor.Rep.Representable Data.Semigroup.Internal.Sum
- Control.Comonad.Representable.Store: StoreT :: (w (g a)) -> (Rep g) -> StoreT g w a
+ Control.Comonad.Representable.Store: StoreT :: w (g a) -> Rep g -> StoreT g w a
- Control.Comonad.Representable.Store: class Comonad w => ComonadStore s (w :: * -> *) | w -> s
+ Control.Comonad.Representable.Store: class Comonad w => ComonadStore s (w :: Type -> Type) | w -> s
- Control.Monad.Representable.Reader: class Monad m => MonadReader r (m :: * -> *) | m -> r
+ Control.Monad.Representable.Reader: class Monad m => MonadReader r (m :: Type -> Type) | m -> r
- Control.Monad.Representable.State: class Monad m => MonadState s (m :: * -> *) | m -> s
+ Control.Monad.Representable.State: class Monad m => MonadState s (m :: Type -> Type) | m -> s
- Data.Functor.Rep: extractRepBy :: Representable f => (Rep f) -> f a -> a
+ Data.Functor.Rep: extractRepBy :: Representable f => Rep f -> f a -> a
- Data.Functor.Rep: ifoldMapRep :: forall r m a. (Representable r, Foldable r, Monoid m) => (Rep r -> a -> m) -> (r a -> m)
+ Data.Functor.Rep: ifoldMapRep :: forall r m a. (Representable r, Foldable r, Monoid m) => (Rep r -> a -> m) -> r a -> m
- Data.Functor.Rep: imapRep :: Representable r => (Rep r -> a -> a') -> (r a -> r a')
+ Data.Functor.Rep: imapRep :: Representable r => (Rep r -> a -> a') -> r a -> r a'
- Data.Functor.Rep: itraverseRep :: forall r f a a'. (Representable r, Traversable r, Applicative f) => (Rep r -> a -> f a') -> (r a -> f (r a'))
+ Data.Functor.Rep: itraverseRep :: forall r f a a'. (Representable r, Traversable r, Applicative f) => (Rep r -> a -> f a') -> r a -> f (r a')
Files
- .travis.yml +0/−146
- CHANGELOG.markdown +4/−0
- README.markdown +1/−1
- adjunctions.cabal +23/−11
- src/Control/Comonad/Representable/Store.hs +5/−2
- src/Control/Monad/Representable/State.hs +1/−0
- src/Data/Functor/Adjunction.hs +1/−1
- src/Data/Functor/Contravariant/Rep.hs +0/−1
- src/Data/Functor/Rep.hs +5/−1
- travis/cabal-apt-install +0/−27
- travis/config +0/−16
− .travis.yml
@@ -1,146 +0,0 @@-# This Travis job script has been generated by a script via-#-# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-installed' '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:- - "\x0313adjunctions\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--addons:- apt:- packages: &apt_packages- - ghc-ppa-tools- - alex-3.1.7- - happy-1.19.5--matrix:- include:- - compiler: "ghc-7.4.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.4.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.6.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.6.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.8.4"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.8.4], sources: [hvr-ghc]}}- - compiler: "ghc-7.10.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.10.3], sources: [hvr-ghc]}}- - compiler: "ghc-8.0.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-8.0.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.2.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.1"- env: GHCHEAD=true- addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}- - compiler: "ghc-head"- env: GHCHEAD=true- addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-head], sources: [hvr-ghc]}}-- allow_failures:- - compiler: "ghc-8.4.1"- - compiler: "ghc-head"--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}- - INSTALLED=${INSTALLED-true}- - 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.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config-- 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-- cabal new-update head.hackage -v- fi- - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'- - "printf 'packages: \".\"\\n' > cabal.project"- - cat cabal.project- - 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/adjunctions-*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;- - "printf 'packages: adjunctions-*/*.cabal\\n' > cabal.project"- - cat cabal.project--- # 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 adjunctions-* && 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","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+4.4.1 [2022.05.07]+------------------+* Allow building with `transformers-0.6.*` and `mtl-2.3.*`.+ 4.4 [2018.01.28] ---------------- * Added `imapRep`, `ifoldMapRep`, `itraverseRep` to make it easier to define representable `FunctorWithIndex`, `FoldableWithIndex`, `TraversableWithIndex` instances from the `lens` package.
README.markdown view
@@ -1,7 +1,7 @@ adjunctions ========== -[](https://hackage.haskell.org/package/adjunctions) [](http://travis-ci.org/ekmett/adjunctions)+[](https://hackage.haskell.org/package/adjunctions) [](https://github.com/ekmett/adjunctions/actions?query=workflow%3AHaskell-CI) This package provides adjunctions for Haskell.
adjunctions.cabal view
@@ -1,8 +1,8 @@ name: adjunctions category: Data Structures, Adjunctions-version: 4.4+version: 4.4.1 license: BSD3-cabal-version: >= 1.8+cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -15,10 +15,7 @@ build-type: Simple extra-source-files: .gitignore- .travis.yml .vim.custom- travis/cabal-apt-install- travis/config HLint.hs CHANGELOG.markdown README.markdown@@ -28,7 +25,12 @@ , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2- , GHC == 8.4.1+ , GHC == 8.4.4+ , GHC == 8.6.5+ , GHC == 8.8.4+ , GHC == 8.10.7+ , GHC == 9.0.2+ , GHC == 9.2.2 source-repository head type: git@@ -49,16 +51,16 @@ array >= 0.3.0.2 && < 0.7, base >= 4 && < 5, comonad >= 4 && < 6,- containers >= 0.3 && < 0.6,+ containers >= 0.3 && < 0.7, contravariant >= 1 && < 2, distributive >= 0.5.1 && < 1, free >= 4 && < 6,- mtl >= 2.0.1 && < 2.3,+ mtl >= 2.0.1 && < 2.4, profunctors >= 4 && < 6, tagged >= 0.7 && < 1, semigroupoids >= 4 && < 6, semigroups >= 0.11 && < 1,- transformers >= 0.2 && < 0.6,+ transformers >= 0.2 && < 0.7, transformers-compat >= 0.3 && < 1, void >= 0.5.5.1 && < 1 @@ -80,10 +82,19 @@ ghc-options: -Wall - -- See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#base-4.9.0.0+ default-language: Haskell2010+ if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances+ -- See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#base-4.9.0.0+ ghc-options: -Wcompat -Wnoncanonical-monad-instances+ ghc-options: -Wno-trustworthy-safe -Wno-inline-rule-shadowing + if !impl(ghc >= 8.8)+ ghc-options: -Wnoncanonical-monadfail-instances++ if impl(ghc >= 8.6)+ ghc-options: -Wno-star-is-type+ test-suite spec type: exitcode-stdio-1.0 hs-source-dirs: tests@@ -100,3 +111,4 @@ other-modules: GenericsSpec ghc-options: -Wall -threaded -rtsopts+ default-language: Haskell2010
src/Control/Comonad/Representable/Store.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -43,7 +44,9 @@ import Data.Functor.Apply import Data.Functor.Extend import Data.Functor.Rep+#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup+#endif -- | A memoized store comonad parameterized by a representable functor @g@, where -- the representatation of @g@, @Rep g@ is the index of the store.@@ -58,8 +61,8 @@ -> Store g a store = storeT . Identity --- | Unwrap a state monad computation as a function.--- (The inverse of 'state'.)+-- | Unwrap a store comonad computation as a function and a current index.+-- (The inverse of 'store'.) runStore :: Representable g => Store g a -- ^ a store to access -> (Rep g -> a, Rep g) -- ^ initial state
src/Control/Monad/Representable/State.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}
src/Data/Functor/Adjunction.hs view
@@ -181,7 +181,7 @@ instance Adjunction m w => Adjunction (WriterT s m) (TracedT s w) where unit = TracedT . leftAdjunct (\ma s -> WriterT (fmap (\a -> (a, s)) ma))- counit = rightAdjunct (\(t, s) -> ($s) <$> runTracedT t) . runWriterT+ counit = rightAdjunct (\(t, s) -> ($ s) <$> runTracedT t) . runWriterT instance (Adjunction f g, Adjunction f' g') => Adjunction (Compose f' f) (Compose g g') where
src/Data/Functor/Contravariant/Rep.hs view
@@ -24,7 +24,6 @@ , contramapRep ) where -import Control.Monad.Reader import Data.Functor.Contravariant import Data.Functor.Product import Data.Profunctor
src/Data/Functor/Rep.hs view
@@ -86,13 +86,15 @@ import Control.Comonad.Trans.Class import Control.Comonad.Trans.Traced import Control.Comonad.Cofree+import Control.Monad.Fix (MonadFix(..)) import Control.Monad.Trans.Identity-import Control.Monad.Reader+import Control.Monad.Reader (MonadReader(..), ReaderT(..)) #if MIN_VERSION_base(4,4,0) import Data.Complex #endif import Data.Distributive import Data.Foldable (Foldable(fold))+import Data.Function import Data.Functor.Bind import Data.Functor.Identity import Data.Functor.Compose@@ -106,7 +108,9 @@ import qualified Data.Sequence as Seq import Data.Semigroup hiding (Product) import Data.Tagged+#if !(MIN_VERSION_base(4,8,0)) import Data.Traversable (Traversable(sequenceA))+#endif import Data.Void import GHC.Generics hiding (Rep) import Prelude hiding (lookup)
− travis/cabal-apt-install
@@ -1,27 +0,0 @@-#! /bin/bash-set -eu--APT="sudo apt-get -q -y"-CABAL_INSTALL_DEPS="cabal install --only-dependencies --force-reinstall"--$APT update-$APT install dctrl-tools--# Find potential system packages to satisfy cabal dependencies-deps()-{- local M='^\([^ ]\+\)-[0-9.]\+ (.*$'- local G=' -o ( -FPackage -X libghc-\L\1\E-dev )'- local E="$($CABAL_INSTALL_DEPS "$@" --dry-run -v 2> /dev/null \- | sed -ne "s/$M/$G/p" | sort -u)"- grep-aptavail -n -sPackage \( -FNone -X None \) $E | sort -u-}--$APT install $(deps "$@") libghc-quickcheck2-dev # QuickCheck is special-$CABAL_INSTALL_DEPS "$@" # Install the rest via Hackage--if ! $APT install hlint ; then- $APT install $(deps hlint)- cabal install hlint-fi-
− travis/config
@@ -1,16 +0,0 @@--- This provides a custom ~/.cabal/config file for use when hackage is down that should work on unix------ This is particularly useful for travis-ci to get it to stop complaining--- about a broken build when everything is still correct on our end.------ This uses Luite Stegeman's mirror of hackage provided by his 'hdiff' site instead------ To enable this, uncomment the before_script in .travis.yml--remote-repo: hdiff.luite.com:http://hdiff.luite.com/packages/archive-remote-repo-cache: ~/.cabal/packages-world-file: ~/.cabal/world-build-summary: ~/.cabal/logs/build.log-remote-build-reporting: anonymous-install-dirs user-install-dirs global