metabrush/src/metabrushes/MetaBrush/Assert.hs

22 lines
400 B
Haskell
Raw Normal View History

{-# LANGUAGE CPP #-}
module MetaBrush.Assert
( assert )
where
-- base
#ifdef ASSERTS
import Control.Exception
( AssertionFailed(..), throw )
#endif
--------------------------------------------------------------------------------
2021-02-23 12:14:32 +00:00
{-# INLINE assert #-}
assert :: Bool -> String -> a -> a
#ifdef ASSERTS
assert False message _ = throw ( AssertionFailed message )
#else
assert _ _ a = a
#endif