packages feed

kan-extensions 2.2 → 2.3

raw patch · 2 files changed

+22/−11 lines, 2 filesdep ~adjunctionsdep ~distributivedep ~mtl

Dependency ranges changed: adjunctions, distributive, mtl, representable-functors, semigroupoids, transformers

Files

Control/Comonad/Density.hs view
@@ -10,8 +10,8 @@ -- Portability :  non-portable (GADTs, MPTCs) -- -- The density comonad for a functor. aka the comonad generated by a functor--- The ''density'' term dates back to Dubuc''s 1974 thesis. The term --- ''monad genererated by a functor'' dates back to 1972 in Street''s +-- The ''density'' term dates back to Dubuc''s 1974 thesis. The term+-- ''monad genererated by a functor'' dates back to 1972 in Street''s -- ''Formal Theory of Monads''. ---------------------------------------------------------------------------- module Control.Comonad.Density@@ -20,8 +20,10 @@   , densityToAdjunction, adjunctionToDensity   ) where +import Control.Applicative import Control.Comonad import Control.Comonad.Trans.Class+import Data.Functor.Apply import Data.Functor.Adjunction  data Density k a where@@ -38,10 +40,19 @@  instance ComonadTrans Density where   lower (Density f c) = extend f c-  ++instance Apply f => Apply (Density f) where+  Density kxf x <.> Density kya y =+    Density (\k -> kxf (fmap fst k) (kya (fmap snd k))) ((,) <$> x <.> y)++instance Applicative f => Applicative (Density f) where+  pure a = Density (const a) (pure ())+  Density kxf x <*> Density kya y =+    Density (\k -> kxf (fmap fst k) (kya (fmap snd k))) (liftA2 (,) x y)+ -- | The natural isomorphism between a comonad w and the comonad generated by w (forwards). liftDensity :: Comonad w => w a -> Density w a-liftDensity = Density extract +liftDensity = Density extract  densityToAdjunction :: Adjunction f g => Density f a -> f (g a) densityToAdjunction (Density f v) = fmap (leftAdjunct f) v
kan-extensions.cabal view
@@ -1,6 +1,6 @@ name:          kan-extensions category:      Data Structures, Monads, Comonads, Functors-version:       2.2+version:       2.3 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -33,17 +33,17 @@     base                   >= 4       && < 5,     comonad                >= 1.1.1.3 && < 1.2,     containers             >= 0.4     && < 0.5,-    transformers           >= 0.3     && < 0.4,-    mtl                    >= 2.1     && < 2.2,-    semigroupoids          >= 1.3     && < 1.4,+    transformers           >= 0.2     && < 0.4,+    mtl                    >= 2.0.1   && < 2.2,+    semigroupoids          >= 1.3.1   && < 1.4,     contravariant          >= 0.2.0.1 && < 0.3,-    distributive           >= 0.2.1   && < 0.3,+    distributive           >= 0.2.2   && < 0.3,     comonad-transformers   >= 2.1     && < 2.2,     comonads-fd            >= 2.1     && < 2.2,     keys                   >= 2.1.3   && < 2.2,     free                   >= 2.1     && < 2.2,-    adjunctions            >= 2.2     && < 2.3,-    representable-functors >= 2.2     && < 2.3,+    adjunctions            >= 2.2.1.1 && < 2.3,+    representable-functors >= 2.2.1.1 && < 2.3,     speculation            >= 1.4.1   && < 1.5    exposed-modules: