diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2016-04-10 23:47:25 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2016-04-10 23:47:25 +0200 |
commit | 8987ce067d187878f82005293f6b215dec66df48 (patch) | |
tree | 281b4e32a1703e72d02e989696eb17d8640103fb /libraries | |
parent | 378091c9ef6d25a076125f0b82dce1a155c0e8f0 (diff) | |
download | haskell-8987ce067d187878f82005293f6b215dec66df48.tar.gz |
Typos in Note
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Control/Monad.hs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index a964581fef..255f80cd28 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -175,8 +175,8 @@ foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () foldM_ f a xs = foldlM f a xs >> return () {- -Note [Worker/wrapper transform on replicateM/replicateM_ --------------------------------------------------------- +Note [Worker/wrapper transform on replicateM/replicateM_] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The implementations of replicateM and replicateM_ both leverage the worker/wrapper transform. The simpler implementation of replicateM_, as an @@ -185,17 +185,14 @@ example, would be: replicateM_ 0 _ = pure () replicateM_ n f = f *> replicateM_ (n - 1) f -However, the self-recrusive nature of this implementation inhibits inlining, +However, the self-recursive nature of this implementation inhibits inlining, which means we never get to specialise to the action (`f` in the code above). By contrast, the implementation below with a local loop makes it possible to -inline the entire definition (as hapens for foldr, for example) thereby +inline the entire definition (as happens for foldr, for example) thereby specialising for the particular action. For further information, see this Trac comment, which includes side-by-side -Core. - -https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6 - +Core: https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6 -} -- | @'replicateM' n act@ performs the action @n@ times, |