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 = liftIO . Control.Exception.Base.evaluate
evaluateWHNF_ :: MonadIO m => a -> m ()
evaluateWHNF_ what = (`seq` ()) <$!> evaluateWHNF what
evaluateNF :: (NFData a, MonadIO m) => a -> m a
evaluateNF = evaluateWHNF . force
evaluateNF_ :: (NFData a, MonadIO m) => a -> m ()
evaluateNF_ = evaluateWHNF . rnf