def two_head
import bend-collections@1.0.0.0/src/containers/internal/intrusive_list.bend as IntrusiveListimport Base
120def two_head(~S: Type, ~N: Data, ~next: S -> N -> S & Maybe<&2, N>, s: S, +head: Maybe<&2, N>) -> S & Bool:
121 match head:
122 case None{}: (s, False{})
123 case Some{n}: nonempty_result(~S, ~N, next(s, n))