OK. How do you easily fork to run a command in the background? How does setting up pipes work? What's the idiom for chdir'ing to a subdirectory such that you pop back out again when you're done (I'd use a subshell with (ch xxx; ...) in bash)?
Getting into more tricky stuff, what's the equivalent of <() in bash?
This doesn't really demonstrate anything that shell scripts are actually written for: orchestrating and composing other processes, and job control.
If you wanted to leverage type checking for safety, it would be more interesting to typecheck the streams input and output by pipes.
Did we read the same article? The entire 'streaming section' is about pipes and I/O redirects. Running a command in the background is just forkIO $ proc ..etc.., as in regular Haskell.
The streaming section of the article has nothing about composing processes, that I could see; it appeared to be about treating the output of commands as input to Haskell lazy lists. I may have misread it, though.
Here's a pattern that comes up fairly frequently for me:
foo | fgrep -v -f <(cut -f 2 info.csv) | bar
It uses the second column in info.csv as fixed strings to match inside lines in the output of foo, and filters them out, with the remaining lines going to bar.
All 4 processes (foo, bar, fgrep, cut) run concurrently. Likely fgrep will block on cut sooner or later, but the point is that multiple communicating concurrent processes are set up using a fairly easy to use DSL.
<(foo) in bash creates a fifo, and pipes the output of foo to the fifo. It then replaces the whole <(foo) argument with the path to the fifo. This means that commands that normally expect to read from a file on the command line can instead be wired to read their input from a process. And, of course, both processes run concurrently.
>(foo) does the same thing, except the other way around, for process output.
Unfortunately, I don't know how to get the name of the device file associated to the pipe, and I need it in order to pass it as an argument to the reading process :(
Getting into more tricky stuff, what's the equivalent of <() in bash?
This doesn't really demonstrate anything that shell scripts are actually written for: orchestrating and composing other processes, and job control.
If you wanted to leverage type checking for safety, it would be more interesting to typecheck the streams input and output by pipes.