bifunctors 3.1 → 3.2
raw patch · 3 files changed
+30/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.Bifunctor.Apply: instance Semigroup s => Biapply ((,,) s)
+ Data.Biapplicative: instance (Monoid x, Monoid y) => Biapplicative ((,,,) x y)
+ Data.Biapplicative: instance (Monoid x, Monoid y, Monoid z) => Biapplicative ((,,,,) x y z)
+ Data.Biapplicative: instance Monoid x => Biapplicative ((,,) x)
+ Data.Bifunctor.Apply: instance (Semigroup x, Semigroup y) => Biapply ((,,,) x y)
+ Data.Bifunctor.Apply: instance (Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z)
+ Data.Bifunctor.Apply: instance Semigroup x => Biapply ((,,) x)
Files
- bifunctors.cabal +1/−1
- src/Data/Biapplicative.hs +19/−0
- src/Data/Bifunctor/Apply.hs +10/−3
bifunctors.cabal view
@@ -1,6 +1,6 @@ name: bifunctors category: Data, Functors-version: 3.1+version: 3.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE
src/Data/Biapplicative.hs view
@@ -22,6 +22,7 @@ import Control.Applicative import Data.Bifunctor import Data.Bifunctor.Apply ((<<$>>))+import Data.Monoid import Data.Tagged infixl 4 <<*>>, <<*, *>>, <<**>>@@ -65,6 +66,24 @@ bipure = (,) {-# INLINE bipure #-} (f, g) <<*>> (a, b) = (f a, g b)+ {-# INLINE (<<*>>) #-}++instance Monoid x => Biapplicative ((,,) x) where+ bipure = (,,) mempty+ {-# INLINE bipure #-}+ (x, f, g) <<*>> (x', a, b) = (mappend x x', f a, g b)+ {-# INLINE (<<*>>) #-}++instance (Monoid x, Monoid y) => Biapplicative ((,,,) x y) where+ bipure = (,,,) mempty mempty+ {-# INLINE bipure #-}+ (x, y, f, g) <<*>> (x', y', a, b) = (mappend x x', mappend y y', f a, g b)+ {-# INLINE (<<*>>) #-}++instance (Monoid x, Monoid y, Monoid z) => Biapplicative ((,,,,) x y z) where+ bipure = (,,,,) mempty mempty mempty+ {-# INLINE bipure #-}+ (x, y, z, f, g) <<*>> (x', y', z', a, b) = (mappend x x', mappend y y', mappend z z', f a, g b) {-# INLINE (<<*>>) #-} instance Biapplicative Tagged where
src/Data/Bifunctor/Apply.hs view
@@ -67,14 +67,21 @@ (f, g) <<.>> (a, b) = (f a, g b) {-# INLINE (<<.>>) #-} -instance Semigroup s => Biapply ((,,) s) where- (s,f,g) <<.>> (t,a,b) = (s <> t, f a, g b)+instance Semigroup x => Biapply ((,,) x) where+ (x, f, g) <<.>> (x', a, b) = (x <> x', f a, g b) {-# INLINE (<<.>>) #-} +instance (Semigroup x, Semigroup y) => Biapply ((,,,) x y) where+ (x, y, f, g) <<.>> (x', y', a, b) = (x <> x', y <> y', f a, g b)+ {-# INLINE (<<.>>) #-}++instance (Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z) where+ (x, y, z, f, g) <<.>> (x', y', z', a, b) = (x <> x', y <> y', z <> z', f a, g b)+ {-# INLINE (<<.>>) #-}+ instance Biapply Const where Const f <<.>> Const x = Const (f x) {-# INLINE (<<.>>) #-}- instance Biapply Tagged where Tagged f <<.>> Tagged x = Tagged (f x)