summaryrefslogtreecommitdiff
path: root/libraries/base/Control/Monad.hs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/Control/Monad.hs')
-rw-r--r--libraries/base/Control/Monad.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 19c9a87bde..00c1fdda37 100644
--- a/libraries/base/Control/Monad.hs
+++ b/libraries/base/Control/Monad.hs
@@ -74,6 +74,9 @@ module Control.Monad
, ap
+ -- ** Strict monadic functions
+
+ , (<$!>)
) where
import Data.Maybe
@@ -311,6 +314,18 @@ is equivalent to
ap :: (Monad m) => m (a -> b) -> m a -> m b
ap = liftM2 id
+infixl 4 <$!>
+
+-- | Strict version of 'Data.Functor.<$>'.
+--
+-- /Since: 4.7.1.0/
+(<$!>) :: Monad m => (a -> b) -> m a -> m b
+{-# INLINE (<$!>) #-}
+f <$!> m = do
+ x <- m
+ let z = f x
+ z `seq` return z
+
-- -----------------------------------------------------------------------------
-- Other MonadPlus functions