Skip to content
Playground(another site)

bynk.types.field_refinement_not_base

Error An inline field refinement requires a base or refined type.

An inline refinement, price: Money where Positive, applies predicates to a value of a base type, or of a refined type over one. A record or a sum has no such value for a predicate to test. Put the refinement on the field that holds the number, inside the record, or declare a refined type and use its name.

Example

type Money = { cents: Int }
type Line = { price: Money where Positive } // ✗ `Money` is a record, which no predicate fits
type Money = { cents: Int where Positive } // ✓ refine the field that holds the number
type Line = { price: Money }

In the Book

See also

  • The grammar rule it governs: record_field.
  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.field_refinement_not_base shows the same from the installed toolchain, without a network.