summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-09-18 23:05:43 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2014-09-18 23:13:02 +0200
commitfbf1e3065bf32317db8e87afe8a58ceee2c02241 (patch)
tree048a58adae5d69e8c3feb48ff12b4ffbc80756eb
parenta94dc4c3067c6a0925e2e39f35ef0930771535f1 (diff)
downloadhaskell-fbf1e3065bf32317db8e87afe8a58ceee2c02241.tar.gz
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
-rw-r--r--libraries/base/Control/Monad.hs5
-rw-r--r--libraries/base/Data/Functor.hs7
2 files changed, 6 insertions, 6 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 534e6527d0..0597055da9 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 00cc254a8b..43ca8218f4 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 ())