Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ New features:
Bugfixes:

Other improvements:
- Fix warnings revealed by v0.14.1 PS release (#135 by @JordanMartinez)

## [v5.0.0](https://github.com/purescript/purescript-foldable-traversable/releases/tag/v5.0.0) - 2021-02-26

Expand Down
4 changes: 2 additions & 2 deletions src/Data/Foldable.purs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ instance foldableMaybe :: Foldable Maybe where
foldr f z (Just x) = x `f` z
foldl _ z Nothing = z
foldl f z (Just x) = z `f` x
foldMap f Nothing = mempty
foldMap _ Nothing = mempty
foldMap f (Just x) = f x

instance foldableFirst :: Foldable First where
Expand Down Expand Up @@ -183,7 +183,7 @@ instance foldableEither :: Foldable (Either a) where
foldr f z (Right x) = f x z
foldl _ z (Left _) = z
foldl f z (Right x) = f z x
foldMap f (Left _) = mempty
foldMap _ (Left _) = mempty
foldMap f (Right x) = f x

instance foldableTuple :: Foldable (Tuple a) where
Expand Down
2 changes: 1 addition & 1 deletion src/Data/FoldableWithIndex.purs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ instance foldableWithIndexEither :: FoldableWithIndex Unit (Either a) where
foldrWithIndex f z (Right x) = f unit x z
foldlWithIndex _ z (Left _) = z
foldlWithIndex f z (Right x) = f unit z x
foldMapWithIndex f (Left _) = mempty
foldMapWithIndex _ (Left _) = mempty
foldMapWithIndex f (Right x) = f unit x

instance foldableWithIndexTuple :: FoldableWithIndex Unit (Tuple a) where
Expand Down
20 changes: 10 additions & 10 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -437,26 +437,26 @@ instance eqIOr :: (Eq l, Eq r) => Eq (IOr l r) where

instance bifoldableIOr :: Bifoldable IOr where
bifoldr l r u (Both fst snd) = l fst (r snd u)
bifoldr l r u (Fst fst) = l fst u
bifoldr l r u (Snd snd) = r snd u
bifoldr l _ u (Fst fst) = l fst u
bifoldr _ r u (Snd snd) = r snd u

bifoldl l r u (Both fst snd) = r (l u fst) snd
bifoldl l r u (Fst fst) = l u fst
bifoldl l r u (Snd snd) = r u snd
bifoldl l _ u (Fst fst) = l u fst
bifoldl _ r u (Snd snd) = r u snd

bifoldMap l r (Both fst snd) = l fst <> r snd
bifoldMap l r (Fst fst) = l fst
bifoldMap l r (Snd snd) = r snd
bifoldMap l _ (Fst fst) = l fst
bifoldMap _ r (Snd snd) = r snd

instance bifunctorIOr :: Bifunctor IOr where
bimap f g (Both fst snd) = Both (f fst) (g snd)
bimap f g (Fst fst) = Fst (f fst)
bimap f g (Snd snd) = Snd (g snd)
bimap f _ (Fst fst) = Fst (f fst)
bimap _ g (Snd snd) = Snd (g snd)

instance bitraversableIOr :: Bitraversable IOr where
bitraverse f g (Both fst snd) = Both <$> f fst <*> g snd
bitraverse f g (Fst fst) = Fst <$> f fst
bitraverse f g (Snd snd) = Snd <$> g snd
bitraverse f _ (Fst fst) = Fst <$> f fst
bitraverse _ g (Snd snd) = Snd <$> g snd

bisequence (Both fst snd) = Both <$> fst <*> snd
bisequence (Fst fst) = Fst <$> fst
Expand Down