module Streamly.Internal.Control.Exception
( assertM
, verify
, verifyM
)
where
import Control.Exception (assert)
{-# INLINE assertM #-}
assertM :: Applicative f => Bool -> f ()
assertM :: forall (f :: * -> *). Applicative f => Bool -> f ()
assertM Bool
predicate = forall a. (?callStack::CallStack) => Bool -> a -> a
assert Bool
predicate (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
{-# INLINE verify #-}
verify :: Bool -> a -> a
verify :: forall a. Bool -> a -> a
verify Bool
predicate a
val =
if Bool
predicate
then forall a. (?callStack::CallStack) => [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 = forall a. Bool -> a -> a
verify Bool
predicate (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())