base: MRP-refactoring of AMP instances
authorHerbert Valerio Riedel <hvr@gnu.org>
Mon, 12 Oct 2015 09:36:01 +0000 (11:36 +0200)
committerHerbert Valerio Riedel <hvr@gnu.org>
Mon, 12 Oct 2015 09:36:12 +0000 (11:36 +0200)
commite737a5126dcfdd0610587d2ec16bea6481cf2a42
tree03b5a0730980021ea72741bc63818e90b10090d0
parent4bd58c179b8d0f8cf2850acb920cef8605826a2a
base: MRP-refactoring of AMP instances

This refactors `(>>)`/`(*>)`/`return`/`pure` methods into normal form.

The redundant explicit `return` method definitions are dropped
altogether.

The explicit `(>>) = (*>)` definitions can't be removed yet, as
the default implementation of `(>>)` is still in terms of `(*>)`
(even though that should have been changed according to the AMP but
wasn't -- see note in GHC.Base for details why this had to be postponed)

A nofib comparision shows this refactoring to result in minor runtime
improvements (unless those are within normal measurement fluctuations):

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
  -------------------------------------------------------------------------
            Min          -0.0%     -0.0%     -1.6%     -3.9%     -1.1%
            Max          -0.0%     +0.0%     +0.5%     +0.5%      0.0%
  Geometric Mean         -0.0%     -0.0%     -0.4%     -0.5%     -0.0%

Full `nofib` report at https://phabricator.haskell.org/P68

Reviewers: quchen, alanz, austin, #core_libraries_committee, bgamari

Reviewed By: bgamari

Differential Revision: https://phabricator.haskell.org/D1316
18 files changed:
libraries/base/Control/Applicative.hs
libraries/base/Control/Arrow.hs
libraries/base/Control/Monad/ST/Lazy/Imp.hs
libraries/base/Data/Complex.hs
libraries/base/Data/Either.hs
libraries/base/Data/Functor/Identity.hs
libraries/base/Data/List/NonEmpty.hs
libraries/base/Data/Monoid.hs
libraries/base/Data/Proxy.hs
libraries/base/Data/Semigroup.hs
libraries/base/Data/Traversable.hs
libraries/base/Data/Version.hs
libraries/base/GHC/Base.hs
libraries/base/GHC/Conc/Sync.hs
libraries/base/GHC/GHCi.hs
libraries/base/GHC/ST.hs
libraries/base/Text/ParserCombinators/ReadP.hs
libraries/base/Text/ParserCombinators/ReadPrec.hs