I generally find the exotic hacks involved with foldr to be ugly, so talking about “foldr for everything” is derisive; the original text I used, withdrawn on fear of causing offense, was “foldr ueber alles”, with an understanding of what “ueber alles” implies in its local political context.
Either case, we still have the issue wherein you have strict datatypes like Vector which cause the failure of exploiting foldr, implying that you have to resort to parameter variables, which, incidentally, I tend to default to.
Ultimately, it’d be nice to have a better solution for iterating through a data structure with short-circuiting behavior than either resorting to foldr (when the laziness of the data structure allows) or parameter variable recursion (which is an ugly emulation of a C-style loop in most cases).
I’m not calling for OCaml-style syntactical loops, but I am interested in if there’s a better functional way to trigger short-circuiting behavior when traversing a data structure than foldr or parameter variable recursion.
I mean, what you could do would be to implement a forBreak_ function, which piggybacks off traversable to implement a boolean argument, but that’d be, first, unergonomic, two, and essentially ad-hoc, when Traversable and Foldable barely follow the typeclass theme of representing mathematical concepts.