bifunctors 3.0 → 3.0.1
raw patch · 4 files changed
+14/−14 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- bifunctors.cabal +1/−1
- src/Data/Bifoldable.hs +7/−7
- src/Data/Bifunctor.hs +5/−5
- src/Data/Bitraversable.hs +1/−1
bifunctors.cabal view
@@ -1,6 +1,6 @@ name: bifunctors category: Data, Functors-version: 3.0+version: 3.0.1 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE
src/Data/Bifoldable.hs view
@@ -9,7 +9,7 @@ -- Portability : portable -- -----------------------------------------------------------------------------module Data.Bifoldable +module Data.Bifoldable ( Bifoldable(..) , bifoldr' , bifoldrM@@ -45,14 +45,14 @@ bifoldl f g z t = appEndo (getDual (bifoldMap (Dual . Endo . flip f) (Dual . Endo . flip g) t)) z instance Bifoldable (,) where- bifoldMap f g (a, b) = f a `mappend` g b+ bifoldMap f g ~(a, b) = f a `mappend` g b instance Bifoldable Either where bifoldMap f _ (Left a) = f a bifoldMap _ g (Right b) = g b bifoldr' :: Bifoldable t => (a -> c -> c) -> (b -> c -> c) -> c -> t a b -> c-bifoldr' f g z0 xs = bifoldl f' g' id xs z0 where +bifoldr' f g z0 xs = bifoldl f' g' id xs z0 where f' k x z = k $! f x z g' k x z = k $! g x z @@ -63,14 +63,14 @@ bifoldl':: Bifoldable t => (a -> b -> a) -> (a -> c -> a) -> a -> t b c -> a bifoldl' f g z0 xs = bifoldr f' g' id xs z0 where- f' x k z = k $! f z x + f' x k z = k $! f z x g' x k z = k $! g z x -bifoldlM :: (Bifoldable t, Monad m) => (a -> b -> m a) -> (a -> c -> m a) -> a -> t b c -> m a +bifoldlM :: (Bifoldable t, Monad m) => (a -> b -> m a) -> (a -> c -> m a) -> a -> t b c -> m a bifoldlM f g z0 xs = bifoldr f' g' return xs z0 where f' x k z = f z x >>= k g' x k z = g z x >>= k- + bitraverse_ :: (Bifoldable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f () bitraverse_ f g = bifoldr ((*>) . f) ((*>) . g) (pure ()) @@ -96,7 +96,7 @@ biconcat = bifold biconcatMap :: Bifoldable t => (a -> [c]) -> (b -> [c]) -> t a b -> [c]-biconcatMap = bifoldMap +biconcatMap = bifoldMap biany :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool biany p q = getAny . bifoldMap (Any . p) (Any . q)
src/Data/Bifunctor.hs view
@@ -22,19 +22,19 @@ first f = bimap f id second :: (b -> c) -> p a b -> p a c- second = bimap id + second = bimap id instance Bifunctor (,) where- bimap f g (a, b) = (f a, g b)+ bimap f g ~(a, b) = (f a, g b) instance Bifunctor ((,,) x) where- bimap f g (x, a, b) = (x, f a, g b)+ bimap f g ~(x, a, b) = (x, f a, g b) instance Bifunctor ((,,,) x y) where- bimap f g (x, y, a, b) = (x, y, f a, g b)+ bimap f g ~(x, y, a, b) = (x, y, f a, g b) instance Bifunctor ((,,,,) x y z) where- bimap f g (x, y, z, a, b) = (x, y, z, f a, g b)+ bimap f g ~(x, y, z, a, b) = (x, y, z, f a, g b) instance Bifunctor Either where bimap f _ (Left a) = Left (f a)
src/Data/Bitraversable.hs view
@@ -38,7 +38,7 @@ bisequence = bimapM id id instance Bitraversable (,) where- bitraverse f g (a, b) = (,) <$> f a <*> g b+ bitraverse f g ~(a, b) = (,) <$> f a <*> g b instance Bitraversable Either where bitraverse f _ (Left a) = Left <$> f a