core.check.
Violation
¶type Violation = Tag(String, Any)
| Equality(Any, Any)
| Identity(Any, Any)
| Any(Array(Any))
| All(Array(Any))
implements
Equality, Extractor, Reflect, Cata, Semigroup, ToString
Represents a violation of an interface’s constraint.
Violation.prototype.
isEquality
¶@Violation => Boolean
true
is the Violation has an Equality
tag.
Violation.prototype.
cata
(aPattern)¶Returns: | The result of applying the right transformation to the Violation. |
---|
@Violation => { r | Pattern } → β
where type Pattern {
Tag: (String, Any) → β,
Equality: (Any, Any) → β,
Identity: (Any, Any) → β,
Any: Array(Any) → β,
All: Array(Any) → β
}
Provides a crude form of pattern matching over the Violation ADT. Since Violation also implements the Extractor interface, you may choose to use the Sparkler Sweet.js macro instead for a more powerful form of pattern matching.