{-# LANGUAGE Trustworthy #-}
module Universum.DeepSeq
( module Control.DeepSeq
, evaluateNF
, evaluateNF_
, evaluateWHNF
, evaluateWHNF_
) where
import Control.DeepSeq (NFData (..), deepseq, force, ($!!))
import Universum.Base (seq)
import Universum.Function ((.))
import Universum.Monad (MonadIO, liftIO, (<$!>))
import qualified Control.Exception.Base (evaluate)
evaluateWHNF :: MonadIO m => a -> m a
evaluateWHNF :: a -> m a
evaluateWHNF = IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> m a) -> (a -> IO a) -> a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> IO a
forall a. a -> IO a
Control.Exception.Base.evaluate
evaluateWHNF_ :: MonadIO m => a -> m ()
evaluateWHNF_ :: a -> m ()
evaluateWHNF_ a
what = (a -> () -> ()
`seq` ()) (a -> ()) -> m a -> m ()
forall (m :: * -> *) a b. Monad m => (a -> b) -> m a -> m b
<$!> a -> m a
forall (m :: * -> *) a. MonadIO m => a -> m a
evaluateWHNF a
what
evaluateNF :: (NFData a, MonadIO m) => a -> m a
evaluateNF :: a -> m a
evaluateNF = a -> m a
forall (m :: * -> *) a. MonadIO m => a -> m a
evaluateWHNF (a -> m a) -> (a -> a) -> a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
forall a. NFData a => a -> a
force
evaluateNF_ :: (NFData a, MonadIO m) => a -> m ()
evaluateNF_ :: a -> m ()
evaluateNF_ = () -> m ()
forall (m :: * -> *) a. MonadIO m => a -> m a
evaluateWHNF (() -> m ()) -> (a -> ()) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ()
forall a. NFData a => a -> ()
rnf