Skip to content
Playground(another site)

bynk.types.embeds_variant_shape

Error An embeds E as V target variant must have exactly one payload field, of type E.

embeds E as V has ? wrap an E error into V, so V must take exactly that: one payload field, of type E. A variant with a payload of another type, or with more or fewer fields, has nowhere to put the error. Give V a single field of type E, or embed a different variant.

Example

type OrderError =
| Payment(reason: String)
embeds PayError as Payment // ✗ the payload is a `String`
type OrderError =
| Payment(reason: PayError)
embeds PayError as Payment // ✓

In the Book

See also

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