metabrush/src/app/MetaBrush/Assert.hs
2021-02-23 13:16:26 +01:00

22 lines
384 B
Haskell

{-# LANGUAGE CPP #-}
module MetaBrush.Assert
( assert )
where
-- base
#ifdef ASSERTS
import Control.Exception
( AssertionFailed(..), throw )
#endif
--------------------------------------------------------------------------------
{-# INLINE assert #-}
assert :: String -> a -> a
#ifdef ASSERTS
assert message _ = throw ( AssertionFailed message )
#else
assert _ a = a
#endif