Is there builtin or idiomatic way in Haskell to "unpack" the elements of a list and treat them as individual arguments to a function?
For example, if I have f :: a -> b -> c -> d -> e
is there something compact like
f (unlist x)
accomplishes
let x = [1,2,3,4] in f (x!!0) (x!!1) (x!!2) (x!!3)
or at least a less "shouty" (too many !!
repetitions) way to unpack a list of known length in general (so that it can be used as arguments to a function, in this case).
Essentially what I'm looking for is something like what Sequence@@
does in Mathematica:
f[Sequence@@{1, 2, 3, 4}]