module Streamly.Internal.Control.Exception
( verify
, verifyM
)
where
{-# INLINE verify #-}
verify :: Bool -> a -> a
verify :: forall a. Bool -> a -> a
verify Bool
predicate a
val =
if Bool
predicate
then [Char] -> a
forall a. HasCallStack => [Char] -> a
error [Char]
"verify failed"
else a
val
{-# INLINE verifyM #-}
verifyM :: Applicative f => Bool -> f ()
verifyM :: forall (f :: * -> *). Applicative f => Bool -> f ()
verifyM Bool
predicate = Bool -> f () -> f ()
forall a. Bool -> a -> a
verify Bool
predicate (() -> f ()
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())