profunctors 4.0.1 → 4.0.2
raw patch · 4 files changed
+22/−2 lines, 4 files
Files
- CHANGELOG.markdown +4/−0
- profunctors.cabal +1/−1
- src/Data/Profunctor.hs +3/−0
- src/Data/Profunctor/Composition.hs +14/−1
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+4.0.2+-----+* Added `assoc` to `Data.Profunctor.Composition` so that we have all 3 associators.+ 4.0 --- * Merged the contents of `profunctor-extras` into `profunctors`.
profunctors.cabal view
@@ -1,6 +1,6 @@ name: profunctors category: Control, Categories-version: 4.0.1+version: 4.0.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE
src/Data/Profunctor.hs view
@@ -179,6 +179,8 @@ -- Minimal complete definition: 'first'' or 'second'' -- -- /Note:/ Every 'Functor' in Haskell is strong.+--+-- <http://takeichi.ipl-lab.org/~asada/papers/arrStrMnd.pdf> class Profunctor p => Strong p where first' :: p a b -> p (a, c) (b, c) first' = dimap swap swap . second'@@ -207,6 +209,7 @@ second' (UpStar f) = UpStar $ \ ~(c, a) -> (,) c <$> f a {-# INLINE second' #-} +-- | Every Arrow is a Strong Monad in Prof instance Arrow p => Strong (WrappedArrow p) where first' (WrapArrow k) = WrapArrow (first k) {-# INLINE first' #-}
src/Data/Profunctor/Composition.hs view
@@ -21,9 +21,10 @@ -- * Profunctor Composition Procompose(..) , procomposed- -- * Lax identity+ -- * Bicategorical Associators , idl , idr+ , assoc -- * Generalized Composition , upstars, kleislis , downstars, cokleislis@@ -128,6 +129,18 @@ -- @ idr :: Profunctor q => Iso (Procompose q (->) d c) (Procompose r (->) d' c') (q d c) (r d' c') idr = dimap (\(Procompose f g) -> rmap g f) (fmap (`Procompose` id))+++-- | The associator for 'Profunctor' composition.+--+-- This provides an 'Iso' for the @lens@ package that witnesses the+-- isomorphism between @'Procompose' p ('Procompose' q r) a b@ and+-- @'Procompose' ('Procompose' p q) r a b@, which arises because+-- @Prof@ is only a bicategory, rather than a strict 2-category.+assoc :: Iso (Procompose p (Procompose q r) a b) (Procompose x (Procompose y z) a b)+ (Procompose (Procompose p q) r a b) (Procompose (Procompose x y) z a b)+assoc = dimap (\(Procompose f (Procompose g h)) -> Procompose (Procompose f g) h)+ (fmap (\(Procompose (Procompose f g) h) -> Procompose f (Procompose g h))) -- | 'Profunctor' composition generalizes 'Functor' composition in two ways. --