Skip to content
Playground(another site)

bynk.store.kind_arity

Error A storage kind was applied to the wrong number of type arguments (e.g. Cell[A, B]).

Each storage kind takes a fixed number of type arguments: Cell[T], Set[T] and Log[T] take one, and Map[K, V] and Cache[K, V] take two. The checker reads the arguments by position, so a wrong count cannot be guessed at and is refused where the field is declared. Give the kind the arguments it takes. To keep a key with a value use Map, and to hold a single value use Cell[T].

Example

store total: Cell[String, Int] // ✗ a `Cell` takes one type argument
store total: Cell[Int] // ✓ one

In the Book

See also

  • Every code in its category, Agent storage, on the diagnostic index.
  • bynk explain bynk.store.kind_arity shows the same from the installed toolchain, without a network.