Hello community,
here is the log from the commit of package ghc-kan-extensions for
openSUSE:Factory checked in at 2017-06-04 01:57:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-kan-extensions (Old)
and /work/SRC/openSUSE:Factory/.ghc-kan-extensions.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-kan-extensions"
Sun Jun 4 01:57:46 2017 rev:4 rq:499710 version:5.0.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-kan-extensions/ghc-kan-extensions.changes
2016-10-24 14:44:20.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-kan-extensions.new/ghc-kan-extensions.changes
2017-06-04 01:57:48.517326337 +0200
@@ -1,0 +2,5 @@
+Thu May 18 09:52:19 UTC 2017 - [email protected]
+
+- Update to version 5.0.2 with cabal2obs.
+
+-------------------------------------------------------------------
Old:
----
kan-extensions-5.0.1.tar.gz
New:
----
kan-extensions-5.0.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-kan-extensions.spec ++++++
--- /var/tmp/diff_new_pack.j3yttk/_old 2017-06-04 01:57:48.993259099 +0200
+++ /var/tmp/diff_new_pack.j3yttk/_new 2017-06-04 01:57:49.001257969 +0200
@@ -1,7 +1,7 @@
#
# spec file for package ghc-kan-extensions
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%global pkg_name kan-extensions
Name: ghc-%{pkg_name}
-Version: 5.0.1
+Version: 5.0.2
Release: 0
Summary: Kan extensions, Kan lifts, various forms of the Yoneda lemma,
and (co)density (co)monads
License: BSD-3-Clause
@@ -32,6 +32,7 @@
BuildRequires: ghc-containers-devel
BuildRequires: ghc-contravariant-devel
BuildRequires: ghc-distributive-devel
+BuildRequires: ghc-fail-devel
BuildRequires: ghc-free-devel
BuildRequires: ghc-mtl-devel
BuildRequires: ghc-rpm-macros
++++++ kan-extensions-5.0.1.tar.gz -> kan-extensions-5.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/.travis.yml
new/kan-extensions-5.0.2/.travis.yml
--- old/kan-extensions-5.0.1/.travis.yml 2016-01-17 03:35:52.000000000
+0100
+++ new/kan-extensions-5.0.2/.travis.yml 2017-05-09 01:46:51.000000000
+0200
@@ -25,12 +25,21 @@
- env: CABALVER=1.22 GHCVER=7.10.1
compiler: ": #GHC 7.10.1"
addons: {apt: {packages:
[cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
- - env: CABALVER=1.22 GHCVER=7.10.2
- compiler: ": #GHC 7.10.2"
- addons: {apt: {packages:
[cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
- - env: CABALVER=1.24 GHCVER=8.0.1
- compiler: ": #GHC 8.0.1"
- addons: {apt: {packages:
[cabal-install-1.24,ghc-8.0.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+ - env: CABALVER=1.22 GHCVER=7.10.3
+ compiler: ": #GHC 7.10.3"
+ addons: {apt: {packages:
[cabal-install-1.22,ghc-7.10.3,alex-3.1.4,happy-1.19.5], 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,alex-3.1.4,happy-1.19.5], 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,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+ - env: CABALVER=head GHCVER=head
+ compiler: ": #GHC head"
+ addons: {apt: {packages:
[cabal-install-head,ghc-head,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+ allow_failures:
+ - env: CABALVER=head GHCVER=head
before_install:
- unset CC
@@ -63,7 +72,6 @@
rm -rf $HOME/.cabsnap;
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
cabal install --only-dependencies --enable-tests --enable-benchmarks;
- if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;
fi
# snapshot package-db on cache miss
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/CHANGELOG.markdown
new/kan-extensions-5.0.2/CHANGELOG.markdown
--- old/kan-extensions-5.0.1/CHANGELOG.markdown 2016-01-17 03:35:53.000000000
+0100
+++ new/kan-extensions-5.0.2/CHANGELOG.markdown 2017-05-09 01:46:51.000000000
+0200
@@ -1,3 +1,7 @@
+5.0.2
+-----
+* Added `hoistCoyoneda`
+
5.0.1
-----
* Removed some redundant constraints
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/kan-extensions.cabal
new/kan-extensions-5.0.2/kan-extensions.cabal
--- old/kan-extensions-5.0.1/kan-extensions.cabal 2016-01-17
03:35:52.000000000 +0100
+++ new/kan-extensions-5.0.2/kan-extensions.cabal 2017-05-09
01:46:51.000000000 +0200
@@ -1,6 +1,6 @@
name: kan-extensions
category: Data Structures, Monads, Comonads, Functors
-version: 5.0.1
+version: 5.0.2
license: BSD3
cabal-version: >= 1.6
license-file: LICENSE
@@ -47,6 +47,7 @@
containers >= 0.4 && < 0.6,
contravariant >= 1 && < 2,
distributive >= 0.2.2 && < 1,
+ fail >= 4.9 && < 5,
free >= 4 && < 5,
mtl >= 2.0.1 && < 2.3,
semigroupoids >= 4 && < 6,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/src/Control/Monad/Co.hs
new/kan-extensions-5.0.2/src/Control/Monad/Co.hs
--- old/kan-extensions-5.0.1/src/Control/Monad/Co.hs 2016-01-17
03:35:52.000000000 +0100
+++ new/kan-extensions-5.0.2/src/Control/Monad/Co.hs 2017-05-09
01:46:51.000000000 +0200
@@ -64,6 +64,7 @@
import Control.Comonad.Store.Class
import Control.Comonad.Traced.Class as Traced
import Control.Monad.Error.Class
+import qualified Control.Monad.Fail as Fail
import Control.Monad.IO.Class
import Control.Monad.Identity
import Control.Monad.Reader.Class as Reader
@@ -104,6 +105,9 @@
return = pure
CoT k >>= f = CoT (k . extend (\wa a -> runCoT (f a) wa))
+instance (Comonad w, Fail.MonadFail m) => Fail.MonadFail (CoT w m) where
+ fail msg = CoT $ \ _ -> Fail.fail msg
+
instance Comonad w => MonadTrans (CoT w) where
lift m = CoT (extract . fmap (m >>=))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/src/Control/Monad/Codensity.hs
new/kan-extensions-5.0.2/src/Control/Monad/Codensity.hs
--- old/kan-extensions-5.0.1/src/Control/Monad/Codensity.hs 2016-01-17
03:35:52.000000000 +0100
+++ new/kan-extensions-5.0.2/src/Control/Monad/Codensity.hs 2017-05-09
01:46:51.000000000 +0200
@@ -32,6 +32,7 @@
import Control.Applicative
import Control.Monad (MonadPlus(..))
+import qualified Control.Monad.Fail as Fail
import Control.Monad.Free
import Control.Monad.IO.Class
import Control.Monad.Reader.Class
@@ -84,6 +85,10 @@
m >>= k = Codensity (\c -> runCodensity m (\a -> runCodensity (k a) c))
{-# INLINE (>>=) #-}
+instance (Fail.MonadFail f) => Fail.MonadFail (Codensity f) where
+ fail msg = Codensity $ \ _ -> Fail.fail msg
+ {-# INLINE fail #-}
+
instance MonadIO m => MonadIO (Codensity m) where
liftIO = lift . liftIO
{-# INLINE liftIO #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/src/Data/Functor/Coyoneda.hs
new/kan-extensions-5.0.2/src/Data/Functor/Coyoneda.hs
--- old/kan-extensions-5.0.1/src/Data/Functor/Coyoneda.hs 2016-01-17
03:35:52.000000000 +0100
+++ new/kan-extensions-5.0.2/src/Data/Functor/Coyoneda.hs 2017-05-09
01:46:51.000000000 +0200
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
+{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
@@ -23,12 +24,12 @@
----------------------------------------------------------------------------
module Data.Functor.Coyoneda
( Coyoneda(..)
- , liftCoyoneda, lowerCoyoneda, lowerM
+ , liftCoyoneda, lowerCoyoneda, lowerM, hoistCoyoneda
-- * as a Left Kan extension
, coyonedaToLan, lanToCoyoneda
) where
-import Control.Applicative
+import Control.Applicative as A
import Control.Monad (MonadPlus(..), liftM)
import Control.Monad.Fix
import Control.Monad.Trans.Class
@@ -84,20 +85,51 @@
{-# INLINE fmap #-}
instance Apply f => Apply (Coyoneda f) where
- m <.> n = liftCoyoneda $ lowerCoyoneda m <.> lowerCoyoneda n
+ Coyoneda mf m <.> Coyoneda nf n =
+ liftCoyoneda $ (\mres nres -> mf mres (nf nres)) <$> m <.> n
{-# INLINE (<.>) #-}
+ Coyoneda _ m .> Coyoneda g n = Coyoneda g (m .> n)
+ {-# INLINE (.>) #-}
+ Coyoneda f m <. Coyoneda _ n = Coyoneda f (m <. n)
+ {-# INLINE (<.) #-}
instance Applicative f => Applicative (Coyoneda f) where
pure = liftCoyoneda . pure
{-# INLINE pure #-}
- m <*> n = liftCoyoneda $ lowerCoyoneda m <*> lowerCoyoneda n
+ Coyoneda mf m <*> Coyoneda nf n =
+ liftCoyoneda $ (\mres nres -> mf mres (nf nres)) <$> m <*> n
{-# INLINE (<*>) #-}
+ Coyoneda _ m *> Coyoneda g n = Coyoneda g (m *> n)
+ {-# INLINE (*>) #-}
+ Coyoneda f m <* Coyoneda _ n = Coyoneda f (m <* n)
+ {-# INLINE (<*) #-}
instance Alternative f => Alternative (Coyoneda f) where
empty = liftCoyoneda empty
{-# INLINE empty #-}
m <|> n = liftCoyoneda $ lowerCoyoneda m <|> lowerCoyoneda n
{-# INLINE (<|>) #-}
+ some = liftCoyoneda . A.some . lowerCoyoneda
+ {-# INLINE some #-}
+ many = liftCoyoneda . A.many . lowerCoyoneda
+ {-# INLINE many #-}
+
+{-
+-- These are slightly optimized versions of the *default*
+-- `some` and `many` definitions for `Coyoneda`. I don't
+-- know if it's worth the clutter to expose them.
+someDefault (Coyoneda vf vb) = liftCoyoneda some_v
+ where
+ many_v = some_v <|> pure []
+ some_v = (:) . vf <$> vb <*> many_v
+{-# INLINE someDefault #-}
+
+manyDefault (Coyoneda vf vb) = liftCoyoneda many_v
+ where
+ many_v = some_v <|> pure []
+ some_v = (:) . vf <$> vb <*> many_v
+{-# INLINE many #-}
+-}
instance Alt f => Alt (Coyoneda f) where
m <!> n = liftCoyoneda $ lowerCoyoneda m <!> lowerCoyoneda n
@@ -118,6 +150,8 @@
#endif
Coyoneda f v >>= k = lift (v >>= lowerM . k . f)
{-# INLINE (>>=) #-}
+ Coyoneda _ m >> Coyoneda g n = Coyoneda g (m >> n)
+ {-# INLINE (>>) #-}
instance MonadTrans Coyoneda where
lift = Coyoneda id
@@ -180,7 +214,7 @@
{-# INLINE showsPrec #-}
#ifdef __GLASGOW_HASKELL__
-instance (Functor f, Read (f a)) => Read (Coyoneda f a) where
+instance Read (f a) => Read (Coyoneda f a) where
readPrec = parens $ prec 10 $ do
Ident "liftCoyoneda" <- lexP
liftCoyoneda <$> step readPrec
@@ -247,3 +281,8 @@
lowerM :: Monad f => Coyoneda f a -> f a
lowerM (Coyoneda f m) = liftM f m
{-# INLINE lowerM #-}
+
+-- | Lift a natural transformation from @f@ to @g@ to a natural transformation
+-- from @Coyoneda f@ to @Coyoneda g@.
+hoistCoyoneda :: (forall a. f a -> g a) -> (Coyoneda f b -> Coyoneda g b)
+hoistCoyoneda f (Coyoneda g x) = Coyoneda g (f x)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/kan-extensions-5.0.1/src/Data/Functor/Day.hs
new/kan-extensions-5.0.2/src/Data/Functor/Day.hs
--- old/kan-extensions-5.0.1/src/Data/Functor/Day.hs 2016-01-17
03:35:52.000000000 +0100
+++ new/kan-extensions-5.0.2/src/Data/Functor/Day.hs 2017-05-09
01:46:51.000000000 +0200
@@ -38,6 +38,8 @@
) where
import Control.Applicative
+import Control.Comonad
+import Control.Comonad.Trans.Class
import Data.Distributive
import Data.Functor.Identity
import Data.Functor.Rep
@@ -84,13 +86,29 @@
(\(a,c) (b,d) -> u a b (v c d))
instance (Representable f, Representable g) => Distributive (Day f g) where
- distribute f = Day (tabulate id) (tabulate id) $ \x y -> fmap (\(Day m n o)
-> o (index m x) (index n y)) f
+ distribute f = Day (tabulate id) (tabulate id) $ \x y ->
+ fmap (\(Day m n o) -> o (index m x) (index n y)) f
+
+ collect g f = Day (tabulate id) (tabulate id) $ \x y ->
+ fmap (\q -> case g q of Day m n o -> o (index m x) (index n y)) f
instance (Representable f, Representable g) => Representable (Day f g) where
type Rep (Day f g) = (Rep f, Rep g)
tabulate f = Day (tabulate id) (tabulate id) (curry f)
index (Day m n o) (x,y) = o (index m x) (index n y)
+instance (Comonad f, Comonad g) => Comonad (Day f g) where
+ extract (Day fb gc bca) = bca (extract fb) (extract gc)
+ duplicate (Day fb gc bca) = Day (duplicate fb) (duplicate gc) (\fb' gc' ->
Day fb' gc' bca)
+
+instance (ComonadApply f, ComonadApply g) => ComonadApply (Day f g) where
+ Day fa fb u <@> Day gc gd v =
+ Day ((,) <$> fa <@> gc) ((,) <$> fb <@> gd)
+ (\(a,c) (b,d) -> u a b (v c d))
+
+instance Comonad f => ComonadTrans (Day f) where
+ lower (Day fb gc bca) = bca (extract fb) <$> gc
+
-- | Day convolution provides a monoidal product. The associativity
-- of this monoid is witnessed by 'assoc' and 'disassoc'.
--