def pop
import bend-collections@1.0.0.0/src/containers/stack.bend as Stackimport Base
import bend-collections@1.0.0.0/src/containers/types/stack.bend as E
20def pop(~T: Data, s: Stack<T>) -> Stack<T> & Result<&2, &2, E.Error, T>:
21 match s:
22 case ST{Nil{}, n}:
23 (ST{Nil{}, n}, Fail{E.EmptyStack{}})
24 case ST{Con{x, xs}, n}:
25 (ST{xs, Nat.sub(n, 1n)}, Done{x})