on c0ec60a help sign in
26 lines 651 B history raw
1-- |
2-- Module : Streamly.Internal.Control.Monad
3-- Copyright : (c) 2019 Composewell Technologies
4--
5-- License : BSD3
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
8-- Portability : GHC
9--
10-- Additional "Control.Monad" utilities.
12module Streamly.Internal.Control.Monad
13 ( discard
14 )
15where
17import Control.Monad (void)
18import Control.Monad.Catch (MonadCatch, catch, SomeException)
20-- | Discard any exceptions or value returned by an effectful action.
21--
22-- /Internal/
23--
24{-# INLINE discard #-}
25discard :: MonadCatch m => m b -> m ()
26discard action = void action `catch` (\(_ :: SomeException) -> return ())