diff --git a/builtin/builtin.mbti b/builtin/builtin.mbti index bebef7700..f96235675 100644 --- a/builtin/builtin.mbti +++ b/builtin/builtin.mbti @@ -179,6 +179,7 @@ impl BigInt { impl Show for BigInt pub(all) type! Failure String +impl Show for Failure type Hasher impl Hasher { diff --git a/builtin/show.mbt b/builtin/show.mbt index 5d233d7e4..f4fe8cf49 100644 --- a/builtin/show.mbt +++ b/builtin/show.mbt @@ -136,6 +136,18 @@ pub impl Show for String with output(self, logger) { ///| pub impl Show for String with to_string(self) { self } +///| +pub impl Show for Failure with to_string(self) { + let Failure(msg) = self + msg +} + +///| +pub impl Show for Failure with output(self, logger) { + let Failure(msg) = self + msg.output(logger) +} + ///| /// Returns a valid MoonBit string literal representation of a string, /// add quotes and escape special characters.