Parsing and evaulation of Boon strings.
In the boon expression:
this OR that
OR is an operator, and this and that are identifiers.
Try to parse a string as a Boon expression, failing on invalid input.
Evaluate an expression by looking up identifiers in a Dict String Bool. If a
key is absent, it will evaluate to False
values =
Dict.fromList
[ ( "foo", True )
, ( "bar", False )
]
(parse "foo OR bar"
|> evalFromDict values) == True
(parse "baz OR bar"
|> evalFromDict values) == FalseEvalute an expression by looking up identifiers in a Set String. Identifiers
present in the set are True, any others are False.
values = Set.fromList ["foo", "bar"]
(parse "foo AND bar"
|> evalFromSet values) == True
(parse "bar AND baz"
|> evalFromSet values) == FalseEvaluate an expression based on a user-provided lookup function that maps identifiers to boolean values.
A parsed Boon expression. Can be evaluated many times