Shell-monad supports variable arguments, however I couldn't find a way to pass a list of such arguments to append. It might be possible to workaround with a function construct present in that library, but I'd like to ask about the general problem.
I have vaguely understood that the "varargs" mechanism is implemented by function composition and recursion is terminated though use of type class inference.
Using that library as an example, I'm wondering if it's possible to treat arguments as "first class" such as assigning two arguments to a variable.
Here's an (incorrect) example that shows my intent.
Prelude Control.Monad.Shell Data.Text> f xs = cmd "cat" xs
Prelude Control.Monad.Shell Data.Text> let a = static ("a" :: Text)
Prelude Control.Monad.Shell Data.Text> let a2 = [a,a]
Prelude Control.Monad.Shell Data.Text> f a2
<interactive>:42:1: error:
• Could not deduce (Param [Term Static Text])
arising from a use of ‘f’
from the context: CmdParams t2
bound by the inferred type of it :: CmdParams t2 => t2
at <interactive>:42:1-4
• In the expression: f a2
In an equation for ‘it’: it = f a2