summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/base/Control/Monad.hs4
-rw-r--r--libraries/base/changelog.md2
2 files changed, 4 insertions, 2 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 6fa4a077d4..be3765d5e2 100644
--- a/libraries/base/Control/Monad.hs
+++ b/libraries/base/Control/Monad.hs
@@ -113,9 +113,9 @@ f >=> g = \x -> f x >>= g
(<=<) = flip (>=>)
-- | @'forever' act@ repeats the action infinitely.
-forever :: (Monad m) => m a -> m b
+forever :: (Applicative f) => f a -> f b
{-# INLINE forever #-}
-forever a = let a' = a >> a' in a'
+forever a = let a' = a *> a' in a'
-- Use explicit sharing here, as it is prevents a space leak regardless of
-- optimizations.
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 363210dbc6..bb09199093 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -40,6 +40,8 @@
* Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative`
(#10023)
+ * Generalise `forever` from `Monad` to `Applicative`
+
## 4.8.1.0 *TBA*
* Bundled with GHC 7.10.2