Skip to content

Commit

Permalink
feat: impl Show for Failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Lampese committed Dec 25, 2024
1 parent 9cb4c07 commit faa2e92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions builtin/builtin.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ impl BigInt {
impl Show for BigInt

pub(all) type! Failure String
impl Show for Failure

type Hasher
impl Hasher {
Expand Down
12 changes: 12 additions & 0 deletions builtin/show.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit faa2e92

Please sign in to comment.