either 5.0.1.1 → 5.0.2
raw patch · 6 files changed
+28/−193 lines, 6 filesdep ~QuickCheckdep ~mtldep ~semigroupoidsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, mtl, semigroupoids
API changes (from Hackage documentation)
Files
- .travis.yml +0/−178
- CHANGELOG.markdown +5/−0
- README.markdown +1/−1
- either.cabal +6/−5
- src/Data/Either/Combinators.hs +4/−6
- src/Data/Either/Validation.hs +12/−3
− .travis.yml
@@ -1,178 +0,0 @@-# This Travis job script has been generated by a script via-#-# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project'-#-# For more information, see https://github.com/haskell-CI/haskell-ci-#-# version: 0.3.20190425-#-language: c-dist: xenial-git:- # whether to recursively clone submodules- submodules: false-notifications:- irc:- channels:- - irc.freenode.org#haskell-lens- skip_join: true- template:- - "\"\\x0313either\\x03/\\x0306%{branch}\\x03 \\x0314%{commit}\\x03 %{build_url} %{message}\""-cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store-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-matrix:- include:- - compiler: ghc-8.8.1- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}- env: GHCHEAD=true- - compiler: ghc-8.6.5- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}}- - compiler: ghc-8.4.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}- - compiler: ghc-8.2.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}- - compiler: ghc-8.0.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}- - compiler: ghc-7.10.3- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}}- - compiler: ghc-7.8.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-2.4"]}}- - compiler: ghc-7.6.3- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.6.3","cabal-install-2.4"]}}- - compiler: ghc-7.4.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.4.2","cabal-install-2.4"]}}- - compiler: ghc-7.2.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.2.2","cabal-install-2.4"]}}- - compiler: ghc-7.0.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.0.4","cabal-install-2.4"]}}- - compiler: ghc-head- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-head","cabal-install-head"]}}- env: GHCHEAD=true- allow_failures:- - compiler: ghc-head- - compiler: ghc-7.0.4- - compiler: ghc-7.2.2- - compiler: ghc-8.8.1-before_install:- - HC=$(echo "/opt/$CC/bin/ghc" | 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|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))- - echo $HCNUMVER- - CABAL="$CABAL -vnormal+nowrap+markoutput"- - set -o pipefail- - |- echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk- echo 'BEGIN { state = "output"; }' >> .colorful.awk- echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk- echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk- echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk- echo ' if (state == "cabal") {' >> .colorful.awk- echo ' print blue($0)' >> .colorful.awk- echo ' } else {' >> .colorful.awk- echo ' print $0' >> .colorful.awk- echo ' }' >> .colorful.awk- echo '}' >> .colorful.awk- - cat .colorful.awk- - |- color_cabal_output () {- awk -f $TOP/.colorful.awk- }- - echo text | color_cabal_output-install:- - ${CABAL} --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - TEST=--enable-tests- - BENCH=--enable-benchmarks- - GHCHEAD=${GHCHEAD-false}- - rm -f $CABALHOME/config- - |- echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config- echo "remote-build-reporting: anonymous" >> $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- - |- if $GHCHEAD; then- echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config- - echo "repository head.hackage" >> $CABALHOME/config- echo " url: http://head.hackage.haskell.org/" >> $CABALHOME/config- echo " secure: True" >> $CABALHOME/config- echo " root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740" >> $CABALHOME/config- echo " 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb" >> $CABALHOME/config- echo " 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e" >> $CABALHOME/config- echo " key-threshold: 3" >> $CABALHOME/config- fi- - cat $CABALHOME/config- - rm -fv cabal.project cabal.project.local cabal.project.freeze- - travis_retry ${CABAL} v2-update -v- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo 'packages: "."' >> cabal.project- - |- echo "write-ghc-environment-files: always" >> cabal.project- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(either)$' | 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 -w ${HC} ${TEST} ${BENCH} | color_cabal_output- - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"- - rm cabal.project.freeze- - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output-script:- - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)- # Packaging...- - ${CABAL} v2-sdist all | color_cabal_output- # Unpacking...- - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo 'packages: "either-*/*.cabal"' >> cabal.project- - |- echo "write-ghc-environment-files: always" >> cabal.project- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(either)$' | 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 -w ${HC} ${TEST} ${BENCH} all | color_cabal_output- # Testing...- - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output- # cabal check...- - (cd either-* && ${CABAL} -vnormal check)- # haddock...- - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output--# REGENDATA ["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"]-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+5.0.2 [2022.05.07]+------------------+* Tweak error messages of `fromRight'` and `fromLeft'` for clarity.+* Allow building with `mtl-2.3.*`.+ 5.0.1.1 [2019.05.02] -------------------- * Only incur a `semigroups` dependency on pre-8.0 GHCs.
README.markdown view
@@ -1,7 +1,7 @@ either ====== -[](https://hackage.haskell.org/package/either) [](http://travis-ci.org/ekmett/either)+[](https://hackage.haskell.org/package/either) [](https://github.com/ekmett/either/actions?query=workflow%3AHaskell-CI) Contact Information -------------------
either.cabal view
@@ -1,6 +1,6 @@ name: either category: Control, Monads-version: 5.0.1.1+version: 5.0.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -23,12 +23,13 @@ , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5- , GHC == 8.8.1+ , GHC == 8.8.4+ , GHC == 8.10.4+ , GHC == 9.0.1 extra-source-files: .gitignore .ghci .vim.custom- .travis.yml CHANGELOG.markdown README.markdown @@ -40,7 +41,7 @@ build-depends: base >= 4 && < 5, bifunctors >= 4 && < 6,- mtl >= 2.0 && < 2.3,+ mtl >= 2.0 && < 2.4, profunctors >= 4 && < 6, semigroupoids >= 4 && < 6 @@ -65,5 +66,5 @@ either, test-framework >= 0.8.1.1 && < 0.9, test-framework-quickcheck2 >= 0.3.0.3 && < 0.4,- QuickCheck >= 2.9 && < 2.14+ QuickCheck >= 2.9 && < 2.15 default-language: Haskell2010
src/Data/Either/Combinators.hs view
@@ -93,7 +93,7 @@ -- >>> fromLeft' (Left 12) -- 12 fromLeft' :: Either a b -> a-fromLeft' (Right _) = error "Data.Either.Combinators.fromLeft: Argument takes form 'Right _'" -- yuck+fromLeft' (Right _) = error "Data.Either.Combinators.fromLeft' encountered a value of form 'Right _', consider using Data.Either.Combinators.fromLeft with a default value." -- yuck fromLeft' (Left x) = x -- | Extracts the element out of a 'Right' and@@ -108,7 +108,7 @@ -- >>> fromRight' (Right 12) -- 12 fromRight' :: Either a b -> b-fromRight' (Left _) = error "Data.Either.Combinators.fromRight: Argument takes form 'Left _'" -- yuck+fromRight' (Left _) = error "Data.Either.Combinators.fromRight' encountered a value of form 'Left _', consider using Data.Either.Combinators.fromRight with a default value." -- yuck fromRight' (Right x) = x -- | The 'mapBoth' function takes two functions and applies the first if iff the value@@ -313,10 +313,10 @@ -- | Maybe produce a 'Left', otherwise produce a 'Right'. ----- >>> maybeToRight "default" (Just 12)+-- >>> maybeToLeft "default" (Just 12) -- Left 12 ----- >>> maybeToRight "default" Nothing+-- >>> maybeToLeft "default" Nothing -- Right "default" maybeToLeft :: b -> Maybe a -> Either a b maybeToLeft _ (Just x) = Left x@@ -342,13 +342,11 @@ -- | Swap the 'Left' and 'Right' sides of an 'Either'. ----- @ -- >>> swapEither (Right 3) -- Left 3 -- -- >>> swapEither (Left "error") -- Right "error"--- @ swapEither :: Either e a -> Either a e swapEither = either Right Left {-# INLINE swapEither #-}
src/Data/Either/Validation.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} -----------------------------------------------------------------------------@@ -34,12 +35,18 @@ import Data.Foldable (Foldable(foldr)) import Data.Functor.Alt (Alt((<!>))) import Data.Functor.Apply (Apply ((<.>)))-import Data.Monoid (Monoid(mappend, mempty)) import Data.Profunctor-import Data.Semigroup (Semigroup((<>)))-import Data.Traversable (Traversable(traverse)) import Prelude hiding (foldr) +#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid (Monoid(mappend, mempty))+import Data.Traversable (Traversable(traverse))+#endif++#if !(MIN_VERSION_base(4,11,0))+import Data.Semigroup (Semigroup((<>)))+#endif+ -- | 'Validation' is 'Either' with a Left that is a 'Monoid' data Validation e a = Failure e@@ -98,9 +105,11 @@ instance Monoid e => Monoid (Validation e a) where mempty = Failure mempty+#if !(MIN_VERSION_base(4,11,0)) x@Success{} `mappend` _ = x _ `mappend` x@Success{} = x Failure e1 `mappend` Failure e2 = Failure (e1 `mappend` e2)+#endif type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t)