bynk.types.sequence_needs_result
Error sequenceAll/sequenceTry was called on a list whose elements are not Results. They collect a List[Result[T, E]].
sequenceAll and sequenceTry fold a List[Result[T, E]] into one Result, so every element must already be a Result. A list of plain values has no failures to collect. Map each element through a function that returns a Result first, as in xs.map(check).sequenceAll(). sequenceAll gathers every error, and sequenceTry stops at the first.
Example
fn check(n: Int) -> Result[Int, String] { … }
fn all(xs: List[Int]) -> Result[List[Int], List[String]] { xs.sequenceAll() // ✗ the elements are `Int`s, not `Result`s}
fn all(xs: List[Int]) -> Result[List[Int], List[String]] { xs.map(check).sequenceAll() // ✓}In the Book
See also
- The grammar rule it governs:
method_call. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.sequence_needs_resultshows the same from the installed toolchain, without a network.