packages feed

profunctors 5.5.1 → 5.5.2

raw patch · 5 files changed

+35/−1 lines, 5 files

Files

CHANGELOG.markdown view
@@ -1,3 +1,9 @@+5.5.2 [2020.02.13]+------------------+* Add `Cochoice`, `Costrong`, `Closed`, `Traversing`, and `Mapping` instances+  for `Cayley`.+* Add `Mapping` and `Traversing` instances for `Tannen`.+ 5.5.1 [2019.11.26] ------------------ * Add `Choice`, `Cochoice`, `Closed`, `Strong`, and `Costrong` instances for
profunctors.cabal view
@@ -1,6 +1,6 @@ name:          profunctors category:      Control, Categories-version:       5.5.1+version:       5.5.2 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE
src/Data/Profunctor/Cayley.hs view
@@ -19,6 +19,7 @@ import Control.Comonad import Data.Profunctor import Data.Profunctor.Monad+import Data.Profunctor.Traversing import Data.Profunctor.Unsafe import Prelude hiding ((.), id) @@ -49,9 +50,28 @@   first'  = Cayley . fmap first' . runCayley   second' = Cayley . fmap second' . runCayley +instance (Functor f, Costrong p) => Costrong (Cayley f p) where+  unfirst (Cayley fp) = Cayley (fmap unfirst fp)+  unsecond (Cayley fp) = Cayley (fmap unsecond fp)+ instance (Functor f, Choice p) => Choice (Cayley f p) where   left'   = Cayley . fmap left' . runCayley   right'  = Cayley . fmap right' . runCayley++instance (Functor f, Cochoice p) => Cochoice (Cayley f p) where+  unleft (Cayley fp) = Cayley (fmap unleft fp)+  {-# INLINE unleft #-}+  unright (Cayley fp) = Cayley (fmap unright fp)+  {-# INLINE unright #-}++instance (Functor f, Closed p) => Closed (Cayley f p) where+  closed = Cayley . fmap closed . runCayley++instance (Functor f, Traversing p) => Traversing (Cayley f p) where+  traverse' = Cayley . fmap traverse' . runCayley++instance (Functor f, Mapping p) => Mapping (Cayley f p) where+  map' = Cayley . fmap map' . runCayley  instance (Applicative f, Category p) => Category (Cayley f p) where   id = Cayley $ pure id
src/Data/Profunctor/Mapping.hs view
@@ -24,6 +24,7 @@   ) where  import Control.Arrow (Kleisli(..))+import Data.Bifunctor.Tannen import Data.Distributive import Data.Functor.Compose import Data.Functor.Identity@@ -89,6 +90,9 @@ instance (Applicative m, Distributive m) => Mapping (Star m) where   map' (Star f) = Star (collect f)   roam f = Star #. genMap f .# runStar++instance (Functor f, Mapping p) => Mapping (Tannen f p) where+  map' = Tannen . fmap map' . runTannen  wanderMapping :: Mapping p => (forall f. Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t wanderMapping f = roam ((runIdentity .) #. f .# (Identity .))
src/Data/Profunctor/Traversing.hs view
@@ -20,6 +20,7 @@  import Control.Applicative import Control.Arrow (Kleisli(..))+import Data.Bifunctor.Tannen import Data.Functor.Compose import Data.Functor.Identity import Data.Orphans ()@@ -135,6 +136,9 @@ instance Applicative m => Traversing (Star m) where   traverse' (Star m) = Star (traverse m)   wander f (Star amb) = Star (f amb)++instance (Functor f, Traversing p) => Traversing (Tannen f p) where+  traverse' = Tannen . fmap traverse' . runTannen  newtype CofreeTraversing p a b = CofreeTraversing { runCofreeTraversing :: forall f. Traversable f => p (f a) (f b) }