| ▲ | bos 5 hours ago | |
If you don’t already know about folds, arguably yes. If you do, then a quick glance at whether you’re using foldl’ or foldr tells you about what the function is allowed to do, which cuts down a little on comprehension. List traversals are typically compact enough that there’s not a huge difference either way. One advantage of using a fold, even in these cases, is that newcomers to Haskell often get so carried away with (and confused by) the power of pattern matching that they’ll write bizarre overly-complicated list traversals by hand, when a simpler mechanism exists that they just haven’t yet internalized. | ||