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