summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryanglscott <>2018-01-18 20:09:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-01-18 20:09:00 (GMT)
commitfa83232286707c51f42fa0c4081c21ba89643349 (patch)
tree4bb6a9309ceb47d713e80073fb17b0fff61f5718
parent2148fb2963df4d771ec85c17405aeaf820f848c3 (diff)
version 5.2.25.2.2
-rw-r--r--.travis.yml220
-rw-r--r--CHANGELOG.markdown12
-rw-r--r--semigroupoids.cabal23
-rw-r--r--src/Data/Functor/Alt.hs15
-rw-r--r--src/Data/Functor/Apply.hs5
-rw-r--r--src/Data/Functor/Bind.hs1
-rw-r--r--src/Data/Functor/Bind/Class.hs19
-rw-r--r--src/Data/Functor/Bind/Trans.hs2
-rw-r--r--src/Data/Groupoid.hs19
-rw-r--r--src/Data/Semigroup/Bitraversable.hs2
-rw-r--r--src/Data/Semigroup/Traversable.hs3
-rw-r--r--src/Data/Semigroupoid.hs19
12 files changed, 228 insertions, 112 deletions
diff --git a/.travis.yml b/.travis.yml
index 9d6a11b..b1dd5f2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,121 +1,147 @@
-# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
+# 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:
+ - "\x0313semigroupoids\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
+
cache:
directories:
- - $HOME/.cabsnap
- $HOME/.cabal/packages
+ - $HOME/.cabal/store
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
+ # 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:
- - env: CABALVER=1.24 GHCVER=7.0.4
- compiler: ": #GHC 7.0.4"
- addons: {apt: {packages: [cabal-install-1.24,ghc-7.0.4], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=7.2.2
- compiler: ": #GHC 7.2.2"
- addons: {apt: {packages: [cabal-install-1.24,ghc-7.2.2], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=7.4.2
- compiler: ": #GHC 7.4.2"
- addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=7.6.3
- compiler: ": #GHC 7.6.3"
- addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=7.8.4
- compiler: ": #GHC 7.8.4"
- addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=7.10.3
- compiler: ": #GHC 7.10.3"
- addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=8.0.2
- compiler: ": #GHC 8.0.2"
- addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}
- - env: CABALVER=2.0 GHCVER=8.2.1
- compiler: ": #GHC 8.2.1"
- addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.1], sources: [hvr-ghc]}}
- - env: CABALVER=head GHCVER=head
- compiler: ": #GHC head"
- addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
+ - compiler: "ghc-7.0.4"
+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
+ addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.0.4], sources: [hvr-ghc]}}
+ - compiler: "ghc-7.2.2"
+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
+ addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.2.2], sources: [hvr-ghc]}}
+ - 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:
- - env: CABALVER=1.24 GHCVER=7.0.4
- - env: CABALVER=1.24 GHCVER=7.2.2
- - env: CABALVER=head GHCVER=head
+ - compiler: "ghc-7.0.4"
+ - compiler: "ghc-7.2.2"
+ - compiler: "ghc-8.4.1"
+ - compiler: "ghc-head"
before_install:
- - unset CC
- - export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
+ - 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 "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- - 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 -v
- - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
- - cabal install --only-dependencies --enable-tests --dry -v > installplan.txt
- - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
-
-# check whether current requested install-plan matches cached package-db snapshot
- - 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 -j --only-dependencies --enable-tests;
- fi
-
-# snapshot package-db on cache miss
- - 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
-
-# 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.
+ - 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:
- # -v2 provides useful information for debugging
- - cabal configure --enable-tests -v2
+ # test that source-distributions can be generated
+ - (cd "." && cabal sdist)
+ - mv "."/dist/semigroupoids-*.tar.gz ${DISTDIR}/
+ - cd ${DISTDIR} || false
+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
+ - "printf 'packages: semigroupoids-*/*.cabal\\n' > cabal.project"
+ - cat cabal.project
- # this builds all libraries and executables
- # (including tests/benchmarks)
- - cabal build
- - cabal test
+ # 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
- # tests that a source-distribution can be generated
- - cabal sdist
+ # cabal check
+ - (cd semigroupoids-* && cabal check)
- # check that the generated source-distribution can be built & installed
- - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
- cd dist/;
- if [ -f "$SRC_TGZ" ]; then
- cabal install --force-reinstalls "$SRC_TGZ";
- else
- echo "expected '$SRC_TGZ' not found";
- exit 1;
- fi
+ # haddock
+ - rm -rf ./dist-newstyle
+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
-notifications:
- irc:
- channels:
- - "irc.freenode.org#haskell-lens"
- skip_join: true
- template:
- - "\x0313semigroupoids\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
+# REGENDATA ["-o",".travis.yml","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]
+# EOF
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index ae53d75..bae1d41 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,3 +1,15 @@
+5.2.2 [2018.01.18]
+------------------
+* Add `optional` to `Data.Functor.Alt` (analogous to the `optional` function
+ in `Control.Applicative`)
+* `liftF2` is now a class method of `Apply` (mirroring the fact that `liftA2`
+ is now a class method of `Applicative`). `liftF2` and `(<.>)` have default
+ definitions in terms of the other.
+* Allow building with GHC 8.4
+* `Apply` and `Bind` instances for `Q`, from the `template-haskell` package.
+* Add instances for `(:~:)` and `(:~~:)` from `Data.Type.Equality`, and
+ `Coercion` from `Data.Type.Coercion`
+
5.2.1
-----
* Add the `toNonEmpty` method to `Foldable1`. Add `foldrM1` and `foldlM1`
diff --git a/semigroupoids.cabal b/semigroupoids.cabal
index 96a1420..76cc2af 100644
--- a/semigroupoids.cabal
+++ b/semigroupoids.cabal
@@ -1,6 +1,6 @@
name: semigroupoids
category: Control, Comonads
-version: 5.2.1
+version: 5.2.2
license: BSD3
cabal-version: >= 1.8
license-file: LICENSE
@@ -10,7 +10,15 @@ stability: provisional
homepage: http://github.com/ekmett/semigroupoids
bug-reports: http://github.com/ekmett/semigroupoids/issues
copyright: Copyright (C) 2011-2015 Edward A. Kmett
-tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1
+tested-with: GHC == 7.0.4
+ , GHC == 7.2.2
+ , GHC == 7.4.2
+ , GHC == 7.6.3
+ , GHC == 7.8.4
+ , GHC == 7.10.3
+ , GHC == 8.0.2
+ , GHC == 8.2.2
+ , GHC == 8.4.1
build-type: Custom
synopsis: Semigroupoids: Category sans id
extra-source-files:
@@ -132,13 +140,14 @@ library
base-orphans >= 0.5.4 && < 1,
bifunctors >= 5 && < 6,
semigroups >= 0.8.3.1 && < 1,
+ template-haskell,
transformers >= 0.2 && < 0.6,
transformers-compat >= 0.5 && < 0.6
- if impl(ghc >= 7.0 && < 7.4)
- build-depends: generic-deriving >= 1.11 && < 1.12
+ if impl(ghc >= 7.0 && < 7.2)
+ build-depends: generic-deriving >= 1.11 && < 1.13
- if impl(ghc >= 7.4 && < 7.6)
+ if impl(ghc >= 7.2 && < 7.6)
build-depends: ghc-prim
if flag(containers)
@@ -154,7 +163,7 @@ library
build-depends: comonad >= 4.2.6 && < 6
if flag(tagged)
- build-depends: tagged >= 0.7.3 && < 1
+ build-depends: tagged >= 0.8.5 && < 1
if flag(unordered-containers)
build-depends: hashable >= 1.1 && < 1.3,
@@ -198,5 +207,5 @@ test-suite doctests
else
build-depends:
base >= 4 && < 5,
- doctest >= 0.11.1 && < 0.13,
+ doctest >= 0.11.1 && < 0.14,
semigroupoids
diff --git a/src/Data/Functor/Alt.hs b/src/Data/Functor/Alt.hs
index 464891e..d948301 100644
--- a/src/Data/Functor/Alt.hs
+++ b/src/Data/Functor/Alt.hs
@@ -24,10 +24,11 @@
----------------------------------------------------------------------------
module Data.Functor.Alt
( Alt(..)
+ , optional
, module Data.Functor.Apply
) where
-import Control.Applicative hiding (some, many)
+import Control.Applicative hiding (some, many, optional)
import Control.Applicative.Backwards
import Control.Applicative.Lift
import Control.Arrow
@@ -50,8 +51,8 @@ import Data.Functor.Bind
import Data.Functor.Compose
import Data.Functor.Product
import Data.Functor.Reverse
-import Data.Semigroup hiding (Product)
import Data.List.NonEmpty (NonEmpty(..))
+import Data.Semigroup (Option(..), Semigroup(..))
import Prelude (($),Either(..),Maybe(..),const,IO,Ord,(++),(.),either,seq,undefined)
import Unsafe.Coerce
@@ -61,6 +62,11 @@ import Data.IntMap (IntMap)
import Data.Sequence (Seq)
import qualified Data.Map as Map
import Data.Map (Map)
+# if MIN_VERSION_base(4,8,0)
+import Prelude (mappend)
+# else
+import Data.Monoid (mappend)
+# endif
#endif
#if defined(MIN_VERSION_tagged) || (MIN_VERSION_base(4,7,0))
@@ -73,6 +79,7 @@ import Generics.Deriving.Base
import GHC.Generics
#endif
+
infixl 3 <!>
-- | Laws:
@@ -117,6 +124,10 @@ class Functor f => Alt f where
where many_v = some_v <!> pure []
some_v = (:) <$> v <*> many_v
+-- | One or none.
+optional :: (Alt f, Applicative f) => f a -> f (Maybe a)
+optional v = Just <$> v <!> pure Nothing
+
instance (Alt f, Alt g) => Alt (f :*: g) where
(as :*: bs) <!> (cs :*: ds) = (as <!> cs) :*: (bs <!> ds)
diff --git a/src/Data/Functor/Apply.hs b/src/Data/Functor/Apply.hs
index 09e8aee..0ff2070 100644
--- a/src/Data/Functor/Apply.hs
+++ b/src/Data/Functor/Apply.hs
@@ -23,7 +23,6 @@ module Data.Functor.Apply (
, Apply(..)
, (<..>) -- :: Apply w => w a -> w (a -> b) -> w b
- , liftF2 -- :: Apply w => (a -> b -> c) -> w a -> w b -> w c
, liftF3 -- :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d
-- * Wrappers
@@ -41,10 +40,6 @@ infixl 4 <..>
(<..>) = liftF2 (flip id)
{-# INLINE (<..>) #-}
--- | Lift a binary function into a comonad with zipping
-liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c
-liftF2 f a b = f <$> a <.> b
-{-# INLINE liftF2 #-}
-- | Lift a ternary function into a comonad with zipping
liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d
diff --git a/src/Data/Functor/Bind.hs b/src/Data/Functor/Bind.hs
index 0db7c06..9a156de 100644
--- a/src/Data/Functor/Bind.hs
+++ b/src/Data/Functor/Bind.hs
@@ -25,7 +25,6 @@ module Data.Functor.Bind (
-- * Applyable functors
, Apply(..)
, (<..>) -- :: Apply w => w a -> w (a -> b) -> w b
- , liftF2 -- :: Apply w => (a -> b -> c) -> w a -> w b -> w c
, liftF3 -- :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d
-- * Wrappers
, WrappedApplicative(..)
diff --git a/src/Data/Functor/Bind/Class.hs b/src/Data/Functor/Bind/Class.hs
index 49ca8f0..9cbec06 100644
--- a/src/Data/Functor/Bind/Class.hs
+++ b/src/Data/Functor/Bind/Class.hs
@@ -80,6 +80,7 @@ import Data.Functor.Reverse
import Data.Functor.Extend
import Data.List.NonEmpty
import Data.Orphans ()
+import Language.Haskell.TH (Q)
import Prelude hiding (id, (.))
#if MIN_VERSION_base(4,4,0)
@@ -144,6 +145,7 @@ infixl 4 <.>, <., .>
-- @
class Functor f => Apply f where
(<.>) :: f (a -> b) -> f a -> f b
+ (<.>) = liftF2 id
-- | @ a '.>' b = 'const' 'id' '<$>' a '<.>' b @
(.>) :: f a -> f b -> f b
@@ -153,6 +155,15 @@ class Functor f => Apply f where
(<.) :: f a -> f b -> f a
a <. b = const <$> a <.> b
+ -- | Lift a binary function into a comonad with zipping
+ liftF2 :: (a -> b -> c) -> f a -> f b -> f c
+ liftF2 f a b = f <$> a <.> b
+ {-# INLINE liftF2 #-}
+
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708
+ {-# MINIMAL (<.>) | liftF2 #-}
+#endif
+
#ifdef MIN_VERSION_tagged
instance Apply (Tagged a) where
(<.>) = (<*>)
@@ -269,6 +280,11 @@ instance Apply Complex where
(a :+ b) <.> (c :+ d) = a c :+ b d
#endif
+-- Applicative Q was only added in template-haskell 2.7 (GHC 7.4), so
+-- define in terms of Monad instead.
+instance Apply Q where
+ (<.>) = ap
+
#ifdef MIN_VERSION_containers
-- | A Map is not 'Applicative', but it is an instance of 'Apply'
instance Ord k => Apply (Map k) where
@@ -497,6 +513,9 @@ instance Bind Option where
instance Bind Identity where
(>>-) = (>>=)
+instance Bind Q where
+ (>>-) = (>>=)
+
instance Bind m => Bind (IdentityT m) where
IdentityT m >>- f = IdentityT (m >>- runIdentityT . f)
diff --git a/src/Data/Functor/Bind/Trans.hs b/src/Data/Functor/Bind/Trans.hs
index 805ce2a..7ff4224 100644
--- a/src/Data/Functor/Bind/Trans.hs
+++ b/src/Data/Functor/Bind/Trans.hs
@@ -31,7 +31,9 @@ import qualified Control.Monad.Trans.State.Strict as Strict
import qualified Control.Monad.Trans.Writer.Strict as Strict
import Data.Functor.Bind
import Data.Orphans ()
+#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup hiding (Product)
+#endif
import Prelude hiding (id, (.))
-- | A subset of monad transformers can transform any 'Bind' as well.
diff --git a/src/Data/Groupoid.hs b/src/Data/Groupoid.hs
index 2748e40..864fe75 100644
--- a/src/Data/Groupoid.hs
+++ b/src/Data/Groupoid.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GADTs #-}
#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
#endif
@@ -22,9 +23,27 @@ module Data.Groupoid
import Data.Semigroupoid
import Data.Semigroupoid.Dual
+#if MIN_VERSION_base(4,7,0)
+import qualified Data.Type.Coercion as Co
+import qualified Data.Type.Equality as Eq
+#endif
+
-- | semigroupoid with inverses. This technically should be a category with inverses, except we need to use Ob to define the valid objects for the category
class Semigroupoid k => Groupoid k where
inv :: k a b -> k b a
instance Groupoid k => Groupoid (Dual k) where
inv (Dual k) = Dual (inv k)
+
+#if MIN_VERSION_base(4,7,0)
+instance Groupoid Co.Coercion where
+ inv = Co.sym
+
+instance Groupoid (Eq.:~:) where
+ inv = Eq.sym
+#endif
+
+#if MIN_VERSION_base(4,10,0)
+instance Groupoid (Eq.:~~:) where
+ inv Eq.HRefl = Eq.HRefl
+#endif
diff --git a/src/Data/Semigroup/Bitraversable.hs b/src/Data/Semigroup/Bitraversable.hs
index b55433f..7bacbe3 100644
--- a/src/Data/Semigroup/Bitraversable.hs
+++ b/src/Data/Semigroup/Bitraversable.hs
@@ -15,7 +15,9 @@ module Data.Semigroup.Bitraversable
) where
import Control.Applicative
+#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
+#endif
import Data.Semigroup.Traversable.Class
bifoldMap1Default :: (Bitraversable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m
diff --git a/src/Data/Semigroup/Traversable.hs b/src/Data/Semigroup/Traversable.hs
index 5a8e19d..a9cc1e2 100644
--- a/src/Data/Semigroup/Traversable.hs
+++ b/src/Data/Semigroup/Traversable.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Copyright : (C) 2011-2015 Edward Kmett
@@ -14,7 +15,9 @@ module Data.Semigroup.Traversable
) where
import Control.Applicative
+#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
+#endif
import Data.Semigroup.Traversable.Class
foldMap1Default :: (Traversable1 f, Semigroup m) => (a -> m) -> f a -> m
diff --git a/src/Data/Semigroupoid.hs b/src/Data/Semigroupoid.hs
index ea49fe5..9d0768e 100644
--- a/src/Data/Semigroupoid.hs
+++ b/src/Data/Semigroupoid.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE GADTs #-}
#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
@@ -47,6 +48,11 @@ import Control.Comonad
import Data.Tagged (Tagged (..))
#endif
+#if MIN_VERSION_base(4,7,0)
+import qualified Data.Type.Coercion as Co
+import qualified Data.Type.Equality as Eq
+#endif
+
-- | 'Control.Category.Category' sans 'Control.Category.id'
class Semigroupoid c where
o :: c j k -> c i j -> c i k
@@ -96,3 +102,16 @@ instance Semigroupoid Const where
instance Semigroupoid Tagged where
Tagged b `o` _ = Tagged b
#endif
+
+#if MIN_VERSION_base(4,7,0)
+instance Semigroupoid Co.Coercion where
+ o = flip Co.trans
+
+instance Semigroupoid (Eq.:~:) where
+ o = flip Eq.trans
+#endif
+
+#if MIN_VERSION_base(4,10,0)
+instance Semigroupoid (Eq.:~~:) where
+ o Eq.HRefl Eq.HRefl = Eq.HRefl
+#endif