Assert functions
lib.asserts.assertMsg
assertMsg :: Bool -> String -> Bool
Print a trace message if pred is false.
Intended to be used to augment asserts with helpful error messages.
pred
Condition under which the msg should
not be printed.
msg
Message to print.
Printing when the predicate is false
trace: foo is not bar, silly
stderr> assert failed
]]>
lib.asserts.assertOneOf
assertOneOf :: String -> String ->
StringList -> Bool
Specialized asserts.assertMsg for checking if
val is one of the elements of xs.
Useful for checking enums.
name
The name of the variable the user entered val into,
for inclusion in the error message.
val
The value of what the user provided, to be compared against the values in
xs.
xs
The list of valid values.
Ensuring a user provided a possible value
false
stderr> trace: sslLibrary must be one of "openssl", "libressl", but is: "bearssl"
]]>