packages feed

adjunctions 0.5.2.1 → 0.6.0

raw patch · 2 files changed

+11/−3 lines, 2 filesdep ~distributivePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: distributive

API changes (from Hackage documentation)

+ Data.Functor.Adjunction: distributeAdjunct :: (Adjunction f g, Functor w) => w (g a) -> g (w a)
- Data.Functor.Adjunction: class (Functor f, Functor g) => Adjunction f g | f -> g, g -> f
+ Data.Functor.Adjunction: class (Functor f, Distributive g) => Adjunction f g | f -> g, g -> f

Files

Data/Functor/Adjunction.hs view
@@ -13,6 +13,7 @@ ------------------------------------------------------------------------------------------- module Data.Functor.Adjunction    ( Adjunction(..)+  , distributeAdjunct   , Representation(..)   , repAdjunction   ) where@@ -24,6 +25,7 @@ import Control.Monad.Trans.Reader import Control.Comonad.Trans.Env +import Data.Distributive import Data.Functor.Identity import Data.Functor.Compose -- import qualified Data.Functor.Contravariant.Adjunction as C@@ -33,7 +35,7 @@ -- -- > rightAdjunct unit = id -- > leftAdjunct counit = id -class (Functor f, Functor g) => Adjunction f g | f -> g, g -> f where+class (Functor f, Distributive g) => Adjunction f g | f -> g, g -> f where   unit :: a -> g (f a)   counit :: f (g a) -> a   leftAdjunct :: (f a -> b) -> a -> g b@@ -43,6 +45,12 @@   counit = rightAdjunct id   leftAdjunct f = fmap f . unit   rightAdjunct f = counit . fmap f++-- | Every right adjoint is representable by its left adjoint applied to unit +-- Consequently, we use the isomorphism from ((->) f ()) ~ g to distribute+-- the right adjoint over any other functor.+distributeAdjunct :: (Adjunction f g, Functor w) => w (g a) -> g (w a)+distributeAdjunct wg = leftAdjunct (\a -> fmap (\b -> rightAdjunct (const b) a) wg) ()  instance Adjunction ((,)e) ((->)e) where   leftAdjunct f a e = f (e, a)
adjunctions.cabal view
@@ -1,6 +1,6 @@ name:          adjunctions category:      Data Structures, Adjunctions-version:       0.5.2.1+version:       0.6.0 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -22,7 +22,7 @@     base >= 4 && < 4.4,     contravariant >= 0.1.2 && < 0.2,     comonad >= 1.0 && < 1.1,-    distributive >= 0.1 && < 0.2,+    distributive >= 0.1.1 && < 0.2,     semigroupoids >= 1.1.0 && < 1.2.0,     comonad-transformers >= 1.5 && < 1.6,     transformers >= 0.2.0 && < 0.3