pointed 5.0.1 → 5.0.5
raw patch · 6 files changed
Files
- .travis.yml +0/−138
- CHANGELOG.markdown +19/−0
- README.markdown +1/−1
- pointed.cabal +21/−29
- src/Data/Copointed.hs +1/−33
- src/Data/Pointed.hs +19/−45
− .travis.yml
@@ -1,138 +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:- - "\x0313pointed\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-7.4.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,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: [ghc-ppa-tools,cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.1"- env: GHCHEAD=true- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], 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-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/pointed-*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;- - "printf 'packages: pointed-*/*.cabal\\n' > cabal.project"- - cat cabal.project--- # build & run tests, build benchmarks- - cabal new-build -w ${HC} ${TEST} ${BENCH} all-- # cabal check- - (cd pointed-* && 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,22 @@+5.0.5 [2024.10.26]+------------------+* Require building with GHC 8.0 or later.+* Remove the `-fsemigroups` `cabal` flag, as `pointed` no longer needs to depend+ on the `semigroups` library for backwards compatibility.+* Allow building with `data-default-class-0.2.*`.++5.0.4 [2022.05.07]+------------------+* Allow building with `transformers-0.6.*`.++5.0.3 [2021.11.01]+------------------+* Allow building with `base-4.16` (GHC 9.2).++5.0.2 [2020.09.30]+------------------+* Drop unused `generic-deriving` dependency.+ 5.0.1 ----- * Add `Pointed` and `Copointed` instances for various types from `GHC.Generics`.
README.markdown view
@@ -1,7 +1,7 @@ pointed ======= -[](https://hackage.haskell.org/package/pointed) [](http://travis-ci.org/ekmett/pointed)+[](https://hackage.haskell.org/package/pointed) [](https://github.com/ekmett/pointed/actions?query=workflow%3AHaskell-CI) Haskell 98 pointed and copointed data types.
pointed.cabal view
@@ -1,8 +1,8 @@ name: pointed category: Data-version: 5.0.1+version: 5.0.5 license: BSD3-cabal-version: >= 1.6+cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -13,15 +13,19 @@ synopsis: Pointed and copointed data description: Pointed and copointed data. build-type: Simple-tested-with: GHC == 7.4.2- , GHC == 7.6.3- , GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+tested-with: 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.8+ , GHC == 9.4.8+ , GHC == 9.6.6+ , GHC == 9.8.2+ , GHC == 9.10.1 extra-source-files:- .travis.yml README.markdown CHANGELOG.markdown @@ -45,10 +49,6 @@ description: You can disable the use of the `semigroupoids` package using `-f-semigroupoids`. default: True manual: True-flag semigroups- description: You can disable the use of the `semigroups` package using `-f-semigroups`.- default: True- manual: True flag stm description: You can disable the use of the `stm` package using `-f-stm`. default: True@@ -67,45 +67,37 @@ manual: True library- build-depends: base >= 4.5 && < 5,- data-default-class >= 0.0.1 && < 0.2-- if impl(ghc >= 7.0 && < 7.2)- build-depends: generic-deriving >= 1.11 && < 1.13-- if impl(ghc >= 7.2 && < 7.6)- build-depends: ghc-prim+ build-depends: base >= 4.9 && < 5,+ data-default-class >= 0.0.1 && < 0.3 if flag(comonad) build-depends: comonad >= 5 && < 6 if flag(containers)- build-depends: containers >= 0.4 && < 0.6+ build-depends: containers >= 0.4 && < 0.8 if flag(kan-extensions) build-depends: kan-extensions >= 5 && < 6 if flag(semigroupoids)- build-depends: semigroupoids >= 4 && < 6-- if flag(semigroups)- build-depends: semigroups >= 0.8.3.1 && < 1+ build-depends: semigroupoids >= 4 && < 7 if flag(stm)- build-depends: stm >= 2.1.2.1 && < 2.5+ build-depends: stm >= 2.1.2.1 && < 2.6 if flag(tagged) build-depends: tagged >= 0.5 && < 1 if flag(transformers)- build-depends: transformers >= 0.2 && < 0.6, transformers-compat >= 0.3 && < 1+ build-depends: transformers >= 0.2 && < 0.7, transformers-compat >= 0.3 && < 1 if flag(unordered-containers)- build-depends: hashable >= 1.1 && < 1.3, unordered-containers >= 0.2 && < 0.3+ build-depends: hashable >= 1.1 && < 1.6, unordered-containers >= 0.2 && < 0.3 exposed-modules: Data.Pointed Data.Copointed + default-language: Haskell2010 ghc-options: -Wall hs-source-dirs: src
src/Data/Copointed.hs view
@@ -2,14 +2,11 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} -#ifndef MIN_VERSION_base-#define MIN_VERSION_base(x,y,z) 0-#endif- module Data.Copointed where import Control.Applicative import Data.Default.Class+import GHC.Generics #ifdef MIN_VERSION_comonad import Control.Comonad.Trans.Env@@ -30,10 +27,8 @@ #endif -#if defined(MIN_VERSION_semigroups) || (MIN_VERSION_base(4,9,0)) import Data.Semigroup as Semigroup import Data.List.NonEmpty (NonEmpty(..))-#endif import qualified Data.Monoid as Monoid @@ -41,14 +36,9 @@ import Data.Tagged #endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,8,0)) import Data.Functor.Identity-#endif--#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,9,0)) import Data.Functor.Sum as F import Data.Functor.Compose-#endif #ifdef MIN_VERSION_transformers import Data.Functor.Reverse@@ -59,12 +49,6 @@ import qualified Control.Monad.Trans.Writer.Strict as Strict #endif -#if defined(MIN_VERSION_generic_deriving)-import Generics.Deriving-#else-import GHC.Generics-#endif- -- | 'Copointed' does not require a 'Functor', as the only relationship -- between 'copoint' and 'fmap' is given by a free theorem. @@ -114,19 +98,15 @@ copoint = unTagged #endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,8,0)) instance Copointed Identity where copoint = runIdentity-#endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,9,0)) instance (Copointed p, Copointed q) => Copointed (Compose p q) where copoint = copoint . copoint . getCompose instance (Copointed f, Copointed g) => Copointed (F.Sum f g) where copoint (F.InL m) = copoint m copoint (F.InR m) = copoint m-#endif #ifdef MIN_VERSION_transformers instance Copointed f => Copointed (Backwards f) where@@ -158,7 +138,6 @@ instance Copointed Monoid.Product where copoint = Monoid.getProduct -#if defined(MIN_VERSION_semigroups) || (MIN_VERSION_base(4,9,0)) instance Copointed NonEmpty where copoint ~(a :| _) = a @@ -176,20 +155,9 @@ instance Copointed WrappedMonoid where copoint = unwrapMonoid-#endif -#ifdef MIN_VERSION_semigroups-#if MIN_VERSION_semigroups(0,16,2)-#define HAVE_ARG 1-#endif-#elif MIN_VERSION_base(4,9,0)-#define HAVE_ARG 1-#endif--#ifdef HAVE_ARG instance Copointed (Arg a) where copoint (Arg _ b) = b-#endif #ifdef MIN_VERSION_semigroupoids instance Copointed f => Copointed (WrappedApplicative f) where
src/Data/Pointed.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}-{-# OPTIONS_GHC -fno-warn-deprecations #-}+{-# OPTIONS_GHC -Wno-deprecations #-} #ifndef MIN_VERSION_base #define MIN_VERSION_base(x,y,z) 0@@ -13,6 +13,7 @@ import Control.Applicative import qualified Data.Monoid as Monoid import Data.Default.Class+import GHC.Generics #ifdef MIN_VERSION_comonad import Control.Comonad@@ -32,10 +33,8 @@ import Data.Functor.Day.Curried #endif -#if defined(MIN_VERSION_semigroups) || (MIN_VERSION_base(4,9,0)) import Data.Semigroup as Semigroup-import Data.List.NonEmpty-#endif+import Data.List.NonEmpty (NonEmpty(..)) #ifdef MIN_VERSION_semigroupoids import Data.Functor.Bind@@ -46,14 +45,10 @@ import Control.Concurrent.STM #endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,8,0)) import Data.Functor.Identity-#endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,9,0)) import Data.Functor.Compose import qualified Data.Functor.Product as Functor-#endif #ifdef MIN_VERSION_transformers import Data.Functor.Constant@@ -67,17 +62,18 @@ import Control.Applicative.Backwards import Control.Applicative.Lift import Control.Monad.Trans.Cont-import Control.Monad.Trans.Error import Control.Monad.Trans.Except-import Control.Monad.Trans.List import Control.Monad.Trans.Maybe import Control.Monad.Trans.Identity import Control.Monad.Trans.Reader++# if !(MIN_VERSION_transformers(0,6,0))+import Control.Monad.Trans.Error+import Control.Monad.Trans.List+# endif #endif -#if defined(MIN_VERSION_tagged) || (MIN_VERSION_base(4,7,0)) import Data.Proxy-#endif #ifdef MIN_VERSION_tagged import Data.Tagged@@ -89,12 +85,6 @@ import qualified Data.HashMap.Lazy as HashMap #endif -#if defined(MIN_VERSION_generic_deriving)-import Generics.Deriving-#else-import GHC.Generics-#endif- class Pointed p where point :: a -> p a @@ -113,10 +103,8 @@ instance Pointed ZipList where point = pure -#if MIN_VERSION_base(4,8,0) || defined(MIN_VERSION_transformers) instance Pointed Identity where point = Identity-#endif instance Pointed ((->)e) where point = const@@ -178,7 +166,7 @@ #ifdef MIN_VERSION_kan_extensions instance (Functor g, g ~ h) => Pointed (Curried g h) where- point a = Curried (fmap ($a))+ point a = Curried (fmap ($ a)) {-# INLINE point #-} #endif @@ -193,7 +181,6 @@ point = MaybeApply . Right #endif -#if defined(MIN_VERSION_semigroups) || (MIN_VERSION_base(4,9,0)) instance Pointed NonEmpty where point a = a :| [] @@ -209,67 +196,46 @@ instance Pointed Semigroup.Min where point = Semigroup.Min +#if !(MIN_VERSION_base(4,16,0)) instance Pointed Option where point = Option . Just+#endif instance Pointed WrappedMonoid where point = WrapMonoid-#endif -#ifdef MIN_VERSION_semigroups-#if MIN_VERSION_semigroups(0,16,2)-#define HAVE_ARG 1-#endif-#elif MIN_VERSION_base(4,9,0)-#define HAVE_ARG 1-#endif--#ifdef HAVE_ARG instance Default a => Pointed (Arg a) where point = Arg def-#endif #ifdef MIN_VERSION_stm instance Pointed STM where point = return #endif -#if defined(MIN_VERSION_tagged) || (MIN_VERSION_base(4,7,0)) instance Pointed Proxy where point _ = Proxy-#endif #ifdef MIN_VERSION_tagged instance Pointed (Tagged a) where point = Tagged #endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,9,0)) instance (Pointed p, Pointed q) => Pointed (Compose p q) where point = Compose . point . point-#endif -#if defined(MIN_VERSION_transformers) || (MIN_VERSION_base(4,9,0)) instance (Pointed p, Pointed q) => Pointed (Functor.Product p q) where point a = Functor.Pair (point a) (point a)-#endif #ifdef MIN_VERSION_transformers instance Pointed (ContT r m) where point a = ContT ($ a) -instance Pointed m => Pointed (ErrorT e m) where- point = ErrorT . point . Right- instance Pointed m => Pointed (ExceptT e m) where point = ExceptT . point . Right instance Pointed m => Pointed (IdentityT m) where point = IdentityT . point -instance Pointed m => Pointed (ListT m) where- point = ListT . point . point- instance Pointed m => Pointed (MaybeT m) where point = MaybeT . point . point @@ -305,6 +271,14 @@ instance Pointed (Lift f) where point = Pure++# if !(MIN_VERSION_transformers(0,6,0))+instance Pointed m => Pointed (ErrorT e m) where+ point = ErrorT . point . Right++instance Pointed m => Pointed (ListT m) where+ point = ListT . point . point+# endif #endif #if defined(MIN_VERSION_unordered_containers)