assertMsg
lib.assertMsg
Docs pulled from | This Revision | 4 days ago
Throw if pred is false, else return pred. Intended to be used to augment asserts with helpful error messages.
Inputs
pred-
Predicate that needs to succeed, otherwise
msgis thrown msg-
Message to throw in case
predfails
Type
assertMsg :: Bool -> String -> Bool
Examples
lib.asserts.assertMsg usage example
assertMsg false "nope"
stderr> error: nope
assert assertMsg ("foo" == "bar") "foo is not bar, silly"; ""
stderr> error: foo is not bar, silly
Noogle detected
Implementation
The following is the current implementation of this function.
assertMsg = pred: msg: pred || throw msg;