I think the accumulator soFar
becomes False
and then the expression soFar && isOkay element
never evaluates the isOkay element
bit sionce &&
short circuits. But it will still loop over the entire array, all the way to the end.
You could experiement by changing the all
code to:
all : (element -> Bool) -> (Array element -> Bool)
all isOkay =
Array.foldl
(\element soFar -> isOkay element && soFar)
True
Then running that through your Ellie.