3 ms·
In this example I can’t imagine anyone preferring the second style, but there are cases where it’s nicer. For example compare the tacit: foo = h . g . f W
by rebeccaskinner 3y ago
In this example I can’t imagine anyone preferring the second style, but there are cases where it’s nicer. For example compare the tacit:
foo = h . g . f
With the more verbose:
foo x =
let
a = f x
b = g a
c = h b
in c
If a, b, and c have useful names that help you understand the code then the second function might be preferable- but in a lot of cases all the intermediate variables are just adding noise and making it harder to see what’s happening at a glance. The tacit example makes it very clear at a quick glance exactly what’s happening.
My personal rule of thumb is that if you are passing combinators in as arguments to other combinators then you should probably stop, but straightforward chaining is usually okay.