summaryrefslogtreecommitdiff
path: root/libraries/base/GHC
diff options
context:
space:
mode:
authorBaldur Blöndal <baldurpet@gmail.com>2022-09-22 01:27:53 +0000
committerTopsii <tobiashaslop@hotmail.de>2022-11-30 21:16:36 +0100
commitd87f28d810b9c536ca4db7f363163e6d0dd6c93c (patch)
tree558597fb2921abf4c201019f9ade7b0037443751 /libraries/base/GHC
parentb4cfa8e235715d8c73b2ba0ba05ed8ef92629218 (diff)
downloadhaskell-d87f28d810b9c536ca4db7f363163e6d0dd6c93c.tar.gz
Make Functor a quantified superclass of Bifunctor.
See https://github.com/haskell/core-libraries-committee/issues/91 for discussion. This change relates Bifunctor with Functor by requiring second = fmap. Moreover this change is a step towards unblocking the major version bump of bifunctors and profunctors to major version 6. This paves the way to move the Profunctor class into base. For that Functor first similarly becomes a superclass of Profunctor in the new major version 6.
Diffstat (limited to 'libraries/base/GHC')
-rw-r--r--libraries/base/GHC/Base.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index ca815f246d..a078676d0f 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -559,6 +559,18 @@ instance (Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) where
instance (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) where
(u, v, w, a) >>= k = case k a of (u', v', w', b) -> (u <> u', v <> v', w <> w', b)
+-- | @since 4.18.0.0
+instance Functor ((,,,,) a b c d) where
+ fmap f (a, b, c, d, e) = (a, b, c, d, f e)
+
+-- | @since 4.18.0.0
+instance Functor ((,,,,,) a b c d e) where
+ fmap fun (a, b, c, d, e, f) = (a, b, c, d, e, fun f)
+
+-- | @since 4.18.0.0
+instance Functor ((,,,,,,) a b c d e f) where
+ fmap fun (a, b, c, d, e, f, g) = (a, b, c, d, e, f, fun g)
+
-- | @since 4.10.0.0
instance Semigroup a => Semigroup (IO a) where
(<>) = liftA2 (<>)