summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/GHCi.hs
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2015-10-12 11:36:01 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2015-10-12 11:36:12 +0200
commite737a5126dcfdd0610587d2ec16bea6481cf2a42 (patch)
tree03b5a0730980021ea72741bc63818e90b10090d0 /libraries/base/GHC/GHCi.hs
parent4bd58c179b8d0f8cf2850acb920cef8605826a2a (diff)
downloadhaskell-e737a5126dcfdd0610587d2ec16bea6481cf2a42.tar.gz
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
Diffstat (limited to 'libraries/base/GHC/GHCi.hs')
-rw-r--r--libraries/base/GHC/GHCi.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/libraries/base/GHC/GHCi.hs b/libraries/base/GHC/GHCi.hs
index c11863520c..56874a5a12 100644
--- a/libraries/base/GHC/GHCi.hs
+++ b/libraries/base/GHC/GHCi.hs
@@ -38,11 +38,10 @@ instance Functor NoIO where
fmap f (NoIO a) = NoIO (fmap f a)
instance Applicative NoIO where
- pure = return
+ pure a = NoIO (pure a)
(<*>) = ap
instance Monad NoIO where
- return a = NoIO (return a)
(>>=) k f = NoIO (noio k >>= noio . f)
instance GHCiSandboxIO NoIO where