Say there's an l
of type List a
, an e
of type b
which represent an
empty collection and a function add
of type a -> b -> Result x b
.
add
inserts an a
into a b
which is an operation that could fail.
I'd like to apply a fold through l
using add
as the
reducer so that in the end I have a Result with either the b
that contains all
of the a
s in the list or an error.
However, I can't just do List.foldl add e l
because of the signature of add
.