I think part of the confusion may be the types/semantics of contents
. The file out -<.> "txt"
contains a list of filenames, so contents
is a list of filenames. When we need contents
we are requiring the files themselves be created and depended upon, using the filenames to specify which files. When we pass contents
on to cmd
we are passing the filenames which tar
will use to query the files.
So the key point is that readFileLines
doesn't read the files in question, it only reads the filenames out of another file. We have to use need
to make sure that using the files is fine, and then we actually use the files in cmd
. Another way of looking at the three lines is:
- Which files do we want to operate on?
- Make sure those files are ready.
- Use those files.
Does that make sense? There's no relationship with ApplicativeDo
- it's presence wouldn't help us at all.