Skip to content
Playground(another site)

bynk.types.interpolation_non_scalar

Error An interpolation hole holds a value with no string form.

A \(…) hole in a string takes a String, Int, Float, Bool, Decimal, or a refined type over one of them, and nothing else. A record or sum has no canonical text, and Bynk will not print an unreadable stand-in such as [object Object]. An opaque type hides its base, so use .raw first. Turn other values into a String yourself: toHex() or toBase64() on Bytes, toString() on a Duration, toIso() or toString() on an Instant, or interpolate the fields of a record, a ValidationError or a DecodeError.

Example

type User = { name: String }
fn label(u: User) -> String {
"user: \(u)" // ✗ a record has no string form
}
fn label(u: User) -> String {
"user: \(u.name)" // ✓ interpolate the field
}

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.interpolation_non_scalar shows the same from the installed toolchain, without a network.