profunctors 5.6 → 5.6.1
raw patch · 17 files changed
+57/−174 lines, 17 filesdep ~base-orphansdep ~bifunctorsdep ~comonad
Dependency ranges changed: base-orphans, bifunctors, comonad, contravariant, distributive, semigroups, tagged, transformers
Files
- .hlint.yaml +1/−0
- .travis.yml +0/−162
- CHANGELOG.markdown +6/−0
- README.markdown +1/−1
- profunctors.cabal +15/−11
- src/Data/Profunctor.hs +1/−0
- src/Data/Profunctor/Adjunction.hs +1/−0
- src/Data/Profunctor/Choice.hs +7/−0
- src/Data/Profunctor/Closed.hs +3/−0
- src/Data/Profunctor/Composition.hs +1/−0
- src/Data/Profunctor/Mapping.hs +4/−0
- src/Data/Profunctor/Monad.hs +1/−0
- src/Data/Profunctor/Ran.hs +1/−0
- src/Data/Profunctor/Rep.hs +1/−0
- src/Data/Profunctor/Strong.hs +7/−0
- src/Data/Profunctor/Traversing.hs +4/−0
- src/Data/Profunctor/Yoneda.hs +3/−0
.hlint.yaml view
@@ -11,6 +11,7 @@ - MultiParamTypeClasses - PolyKinds - RankNTypes+ - Safe - ScopedTypeVariables - Trustworthy - TypeFamilies
− .travis.yml
@@ -1,162 +0,0 @@-# This Travis job script has been generated by a script via-#-# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project'-#-# To regenerate the script (for example after adjusting tested-with) run-#-# haskell-ci regenerate-#-# For more information, see https://github.com/haskell-CI/haskell-ci-#-# version: 0.10-#-version: ~> 1.0-language: c-os: linux-dist: xenial-git:- # whether to recursively clone submodules- submodules: false-notifications:- irc:- channels:- - irc.freenode.org#haskell-lens- skip_join: true- template:- - "\x0313profunctors\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"-cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store- - $HOME/.hlint-before_cache:- - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log- # remove files that are regenerated by 'cabal update'- - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*- - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx- - rm -rfv $CABALHOME/packages/head.hackage-jobs:- include:- - compiler: ghc-8.10.1- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.8.3- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.6.5- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.4.4- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.2.2- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.0.2- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}- os: linux- - compiler: ghc-7.10.3- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.2"]}}- os: linux- - compiler: ghc-7.8.4- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.2"]}}- os: linux-before_install:- - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')- - WITHCOMPILER="-w $HC"- - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')- - HCPKG="$HC-pkg"- - unset CC- - CABAL=/opt/ghc/bin/cabal- - CABALHOME=$HOME/.cabal- - export PATH="$CABALHOME/bin:$PATH"- - TOP=$(pwd)- - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"- - echo $HCNUMVER- - CABAL="$CABAL -vnormal+nowrap"- - set -o pipefail- - TEST=--enable-tests- - BENCH=--enable-benchmarks- - HEADHACKAGE=false- - rm -f $CABALHOME/config- - |- echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config- echo "remote-build-reporting: anonymous" >> $CABALHOME/config- echo "write-ghc-environment-files: always" >> $CABALHOME/config- echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config- echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config- echo "world-file: $CABALHOME/world" >> $CABALHOME/config- echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config- echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config- echo "installdir: $CABALHOME/bin" >> $CABALHOME/config- echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config- echo "store-dir: $CABALHOME/store" >> $CABALHOME/config- echo "install-dirs user" >> $CABALHOME/config- echo " prefix: $CABALHOME" >> $CABALHOME/config- echo "repository hackage.haskell.org" >> $CABALHOME/config- echo " url: http://hackage.haskell.org/" >> $CABALHOME/config-install:- - ${CABAL} --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - |- echo "program-default-options" >> $CABALHOME/config- echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config- - cat $CABALHOME/config- - rm -fv cabal.project cabal.project.local cabal.project.freeze- - travis_retry ${CABAL} v2-update -v- - if [ $HCNUMVER -ge 81000 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $WITHCOMPILER --dry-run hlint --constraint='hlint ==2.2.*' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi- - "if [ $HCNUMVER -ge 81000 ] ; then if [ ! -e $HOME/.hlint/hlint-$HLINTVER/hlint ]; then echo \"Downloading HLint version $HLINTVER\"; mkdir -p $HOME/.hlint; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\\n' --silent --location --output $HOME/.hlint/hlint-$HLINTVER.tar.gz \"https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz\"; tar -xzv -f $HOME/.hlint/hlint-$HLINTVER.tar.gz -C $HOME/.hlint; fi ; fi"- - if [ $HCNUMVER -ge 81000 ] ; then mkdir -p $CABALHOME/bin && ln -sf "$HOME/.hlint/hlint-$HLINTVER/hlint" $CABALHOME/bin/hlint ; fi- - if [ $HCNUMVER -ge 81000 ] ; then hlint --version ; fi- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo "packages: ." >> cabal.project- - if [ $HCNUMVER -ge 80200 ] ; then echo 'package profunctors' >> cabal.project ; fi- - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"- - |- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(profunctors)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"- - cat cabal.project || true- - cat cabal.project.local || true- - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi- - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}- - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"- - rm cabal.project.freeze- - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all-script:- - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)- # Packaging...- - ${CABAL} v2-sdist all- # Unpacking...- - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;- - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;- - PKGDIR_profunctors="$(find . -maxdepth 1 -type d -regex '.*/profunctors-[0-9.]*')"- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo "packages: ${PKGDIR_profunctors}" >> cabal.project- - if [ $HCNUMVER -ge 80200 ] ; then echo 'package profunctors' >> cabal.project ; fi- - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"- - |- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(profunctors)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"- - cat cabal.project || true- - cat cabal.project.local || true- # Building with tests and benchmarks...- # build & run tests, build benchmarks- - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all- # HLint..- - if [ $HCNUMVER -ge 81000 ] ; then (cd ${PKGDIR_profunctors} && hlint src) ; fi- # cabal check...- - (cd ${PKGDIR_profunctors} && ${CABAL} -vnormal check)- # haddock...- - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all--# REGENDATA ("0.10",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+5.6.1 [2020.12.31]+------------------+* Add `Functor` instances for `PastroSum`, `CopastroSum`, `Environment`,+ `FreeMapping`, `Pastro`, `Copastro`, `FreeTraversing`, and `Coyoneda`.+* Explicitly mark modules as `Safe`.+ 5.6 [2020.10.01] ---------------- * Enable the `PolyKinds` extension. The following datatypes now have
README.markdown view
@@ -1,7 +1,7 @@ Profunctors =========== -[](https://hackage.haskell.org/package/profunctors) [](http://travis-ci.org/ekmett/profunctors)+[](https://hackage.haskell.org/package/profunctors) [](https://github.com/ekmett/profunctors/actions?query=workflow%3AHaskell-CI) Profunctors for Haskell.
profunctors.cabal view
@@ -1,6 +1,6 @@ name: profunctors category: Control, Categories-version: 5.6+version: 5.6.1 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -25,7 +25,6 @@ .ghci .gitignore .hlint.yaml- .travis.yml .vim.custom README.markdown CHANGELOG.markdown@@ -36,17 +35,17 @@ library build-depends:- base >= 4.7 && < 5,- base-orphans >= 0.4 && < 0.9,- bifunctors >= 5.2 && < 6,- comonad >= 4 && < 6,- contravariant >= 1 && < 2,- distributive >= 0.4.4 && < 1,- tagged >= 0.4.4 && < 1,- transformers >= 0.2 && < 0.6+ base >= 4.7 && < 5,+ base-orphans >= 0.8.4 && < 0.9,+ bifunctors >= 5.5.9 && < 6,+ comonad >= 5.0.8 && < 6,+ contravariant >= 1.5.3 && < 2,+ distributive >= 0.5.2 && < 1,+ tagged >= 0.8.6.1 && < 1,+ transformers >= 0.3 && < 0.6 if !impl(ghc >= 8.0)- build-depends: semigroups >= 0.11 && < 0.20+ build-depends: semigroups >= 0.18.5 && < 0.20 exposed-modules: Data.Profunctor@@ -73,6 +72,11 @@ if impl(ghc >= 8.6) ghc-options: -Wno-star-is-type++ 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 hs-source-dirs: src
src/Data/Profunctor.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2015 Edward Kmett,
src/Data/Profunctor/Adjunction.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE RankNTypes #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2015 Edward Kmett
src/Data/Profunctor/Choice.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2014-2015 Edward Kmett@@ -254,6 +255,9 @@ data PastroSum p a b where PastroSum :: (Either y z -> b) -> p x y -> (a -> Either x z) -> PastroSum p a b +instance Functor (PastroSum p a) where+ fmap f (PastroSum l m r) = PastroSum (f . l) m r+ instance Profunctor (PastroSum p) where dimap f g (PastroSum l m r) = PastroSum (g . l) m (r . f) lmap f (PastroSum l m r) = PastroSum l m (r . f)@@ -423,6 +427,9 @@ -- -- 'CopastroSum' freely constructs costrength with respect to 'Either' (aka 'Choice') newtype CopastroSum p a b = CopastroSum { runCopastroSum :: forall r. Cochoice r => (forall x y. p x y -> r x y) -> r a b }++instance Functor (CopastroSum p a) where+ fmap f (CopastroSum h) = CopastroSum $ \ n -> rmap f (h n) instance Profunctor (CopastroSum p) where dimap f g (CopastroSum h) = CopastroSum $ \ n -> dimap f g (h n)
src/Data/Profunctor/Closed.hs view
@@ -195,6 +195,9 @@ data Environment p a b where Environment :: ((z -> y) -> b) -> p x y -> (a -> z -> x) -> Environment p a b +instance Functor (Environment p a) where+ fmap f (Environment l m r) = Environment (f . l) m r+ instance Profunctor (Environment p) where dimap f g (Environment l m r) = Environment (g . l) m (r . f) lmap f (Environment l m r) = Environment l m (r . f)
src/Data/Profunctor/Composition.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Profunctor.Composition
src/Data/Profunctor/Mapping.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2015-2018 Edward Kmett@@ -140,6 +141,9 @@ -- | @FreeMapping -| CofreeMapping@ data FreeMapping p a b where FreeMapping :: Functor f => (f y -> b) -> p x y -> (a -> f x) -> FreeMapping p a b++instance Functor (FreeMapping p a) where+ fmap f (FreeMapping l m r) = FreeMapping (f . l) m r instance Profunctor (FreeMapping p) where lmap f (FreeMapping l m r) = FreeMapping l m (r . f)
src/Data/Profunctor/Monad.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2014-2015 Edward Kmett
src/Data/Profunctor/Ran.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2013-2015 Edward Kmett and Dan Doel
src/Data/Profunctor/Rep.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Profunctor.Rep
src/Data/Profunctor/Strong.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- |@@ -272,6 +273,9 @@ data Pastro p a b where Pastro :: ((y, z) -> b) -> p x y -> (a -> (x, z)) -> Pastro p a b +instance Functor (Pastro p a) where+ fmap f (Pastro l m r) = Pastro (f . l) m r+ instance Profunctor (Pastro p) where dimap f g (Pastro l m r) = Pastro (g . l) m (r . f) lmap f (Pastro l m r) = Pastro l m (r . f)@@ -443,6 +447,9 @@ -- -- Copastro freely constructs costrength newtype Copastro p a b = Copastro { runCopastro :: forall r. Costrong r => (forall x y. p x y -> r x y) -> r a b }++instance Functor (Copastro p a) where+ fmap f (Copastro h) = Copastro $ \ n -> rmap f (h n) instance Profunctor (Copastro p) where dimap f g (Copastro h) = Copastro $ \ n -> dimap f g (h n)
src/Data/Profunctor/Traversing.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE Safe #-} module Data.Profunctor.Traversing ( Traversing(..) , CofreeTraversing(..)@@ -167,6 +168,9 @@ -- | @FreeTraversing -| CofreeTraversing@ data FreeTraversing p a b where FreeTraversing :: Traversable f => (f y -> b) -> p x y -> (a -> f x) -> FreeTraversing p a b++instance Functor (FreeTraversing p a) where+ fmap f (FreeTraversing l m r) = FreeTraversing (f . l) m r instance Profunctor (FreeTraversing p) where lmap f (FreeTraversing l m r) = FreeTraversing l m (r . f)
src/Data/Profunctor/Yoneda.hs view
@@ -155,6 +155,9 @@ joinCoyoneda :: Coyoneda (Coyoneda p) a b -> Coyoneda p a b joinCoyoneda (Coyoneda l r p) = dimap l r p +instance Functor (Coyoneda p a) where+ fmap f (Coyoneda l r' p) = Coyoneda l (f . r') p+ instance Profunctor (Coyoneda p) where dimap l r (Coyoneda l' r' p) = Coyoneda (l' . l) (r . r') p {-# INLINE dimap #-}