Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mappend to <> #36

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions strict/src/Data/Strict/Tuple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ instance (Semigroup a, Semigroup b) => Semigroup (Pair a b) where

instance (Monoid a, Monoid b) => Monoid (Pair a b) where
mempty = mempty :!: mempty
(x1 :!: y1) `mappend` (x2 :!: y2) = (x1 `mappend` x2) :!: (y1 `mappend` y2)
(x1 :!: y1) <> (x2 :!: y2) = (x1 <> x2) :!: (y1 <> y2)

-- deepseq
instance (NFData a, NFData b) => NFData (Pair a b) where
Expand All @@ -194,8 +194,8 @@ instance Bifunctor Pair where
second g (a :!: b) = a :!: g b

instance Bifoldable Pair where
bifold (a :!: b) = a `mappend` b
bifoldMap f g (a :!: b) = f a `mappend` g b
bifold (a :!: b) = a <> b
bifoldMap f g (a :!: b) = f a <> g b
bifoldr f g c (a :!: b) = g b (f a c)
bifoldl f g c (a :!: b) = g (f c a) b

Expand Down Expand Up @@ -231,7 +231,7 @@ instance Eq a => Eq1 (Pair a) where
liftEq = liftEq2 (==)

instance Ord2 Pair where
liftCompare2 f g (a :!: b) (a' :!: b') = f a a' `mappend` g b b'
liftCompare2 f g (a :!: b) (a' :!: b') = f a a' <> g b b'

instance Ord a => Ord1 (Pair a) where
liftCompare = liftCompare2 compare
Expand Down