[commit: ghc] master: Move Control.Monad.void into Data.Functor (fbf1e30)

git at git.haskell.org git at git.haskell.org
Thu Sep 18 21:13:25 UTC 2014


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

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

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

commit fbf1e3065bf32317db8e87afe8a58ceee2c02241
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Thu Sep 18 23:05:43 2014 +0200

    Move Control.Monad.void into Data.Functor
    
    Both modules still export `void`, but `void`'s implementation now lives in
    Data.Functor where it actually belongs in (as it doesn't need a Monad context)
    
    The desired side-effect of this is to invert the import-dep
    between Control.Monad and Data.Functor.
    
    Reviewed By: ekmett, austin
    
    Differential Revision: https://phabricator.haskell.org/D224


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

fbf1e3065bf32317db8e87afe8a58ceee2c02241
 libraries/base/Control/Monad.hs | 5 +----
 libraries/base/Data/Functor.hs  | 7 +++++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 534e652..0597055 100644
--- a/libraries/base/Control/Monad.hs
+++ b/libraries/base/Control/Monad.hs
@@ -76,6 +76,7 @@ module Control.Monad
     , (<$!>)
     ) where
 
+import Data.Functor ( void )
 import Data.Maybe
 
 import GHC.List
@@ -159,10 +160,6 @@ forever a   = let a' = a >> a' in a'
 -- Use explicit sharing here, as it is prevents a space leak regardless of
 -- optimizations.
 
--- | @'void' value@ discards or ignores the result of evaluation, such as the return value of an 'IO' action.
-void :: Functor f => f a -> f ()
-void = fmap (const ())
-
 -- -----------------------------------------------------------------------------
 -- Other monad functions
 
diff --git a/libraries/base/Data/Functor.hs b/libraries/base/Data/Functor.hs
index 00cc254..43ca821 100644
--- a/libraries/base/Data/Functor.hs
+++ b/libraries/base/Data/Functor.hs
@@ -23,8 +23,7 @@ module Data.Functor
       void,
     ) where
 
-import Control.Monad ( void )
-import GHC.Base ( Functor(..), flip )
+import GHC.Base ( Functor(..), const, flip )
 
 infixl 4 <$>
 
@@ -40,3 +39,7 @@ infixl 4 $>
 ($>) :: Functor f => f a -> b -> f b
 ($>) = flip (<$)
 
+-- | @'void' value@ discards or ignores the result of evaluation, such as the
+-- return value of an 'IO' action.
+void :: Functor f => f a -> f ()
+void = fmap (const ())



More information about the ghc-commits mailing list