module Streamly.Internal.Control.Monad
( discard
)
where
import Control.Monad (void)
import Control.Monad.Catch (MonadCatch, catch, SomeException)
{-# INLINE discard #-}
discard :: MonadCatch m => m b -> m ()
discard :: forall (m :: * -> *) b. MonadCatch m => m b -> m ()
discard m b
action = m b -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void m b
action m () -> (SomeException -> m ()) -> m ()
forall e a. (HasCallStack, Exception e) => m a -> (e -> m a) -> m a
forall (m :: * -> *) e a.
(MonadCatch m, HasCallStack, Exception e) =>
m a -> (e -> m a) -> m a
`catch` (\(SomeException
_ :: SomeException) -> () -> m ()
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return ())