Generalise findProgramOnSearchPath to calculate locations looked in
But in this patch, don't actually return them yet, so not yet changing the resturn type. The purpose here is change monitoring. In cabal-install we want to be able to automatically re-run various actions when the build environment changes, including when programs have changed (e.g. due to a $PATH change, finding the compiler in a different location). The basic information required for such change monitoring is not only the location where a program was ultimately found, but all the locations where it was looked for and not found. Otherwise one will miss the case where having previously found the program in one location, later on the program appears earlier in the search path. In this case a build system should notice and react, but if it only monitors the ultimate location where the program was found then this is impossible. The build system also needs to monitor the locations where the program was not found, to make sure it is still not there. This principle actually applies anytime we have a file search (e.g. hs-source-dirs), programs are just one example.