def Sum.checked
import bend-collections-laws-crypto@1.0.0.0/spec/math/generic.bend as Genericimport Base
import bend-collections-laws-crypto@1.0.0.0/src/math/num.bend as N
import bend-collections-laws-crypto@1.0.0.0/src/math/generic.bend as G
import bend-collections-laws-crypto@1.0.0.0/spec/math/natural.bend as NS
204# the partial sums only grow, so the sum overflows exactly when the total does
205def Sum.checked(~T: Data, ~op: N.Op<T> -> T, ~test: N.Test<T> -> Bool, ~val: T -> Nat, ~of: Nat -> T, +w: Nat, xs: List<&2, T>) -> Type:
206 {G.sum(~T, ~op, ~test, xs) == checked(~T, ~of, w, NS.lsum(vals(~T, ~val, xs))) : Result<&2, &2, N.NumError, T>}
Uses (11)
Used by (0)
No other definition uses this definition.