[commit: ghc] master: Define void using <$ (re #9827) (cc7a735)

git at git.haskell.org git at git.haskell.org
Sun Nov 23 21:02:34 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/cc7a735f015510dda6f69d4a48d1b0cdd55856ba/ghc

>---------------------------------------------------------------

commit cc7a735f015510dda6f69d4a48d1b0cdd55856ba
Author: David Feuer <david.feuer at gmail.com>
Date:   Sun Nov 23 22:00:48 2014 +0100

    Define void using <$ (re #9827)
    
    `() <$ x` is sometimes better than `fmap (const ()) x` and should
    never be worse.
    
    Reviewed By: ekmett
    
    Differential Revision: https://phabricator.haskell.org/D521


>---------------------------------------------------------------

cc7a735f015510dda6f69d4a48d1b0cdd55856ba
 libraries/base/Data/Functor.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libraries/base/Data/Functor.hs b/libraries/base/Data/Functor.hs
index 9db4c8f..c12564f 100644
--- a/libraries/base/Data/Functor.hs
+++ b/libraries/base/Data/Functor.hs
@@ -23,7 +23,7 @@ module Data.Functor
       void,
     ) where
 
-import GHC.Base ( Functor(..), const, flip )
+import GHC.Base ( Functor(..), flip )
 
 -- $setup
 -- Allow the use of Prelude in doctests.
@@ -140,4 +140,4 @@ infixl 4 $>
 -- 2
 --
 void :: Functor f => f a -> f ()
-void = fmap (const ())
+void x = () <$ x



More information about the ghc-commits mailing list