
Malcolm Wallace wrote:
Simon Marlow
wrote some fairly convincing arguments against the universal use of get/setPermissions: These functions are hardly ever used.
There are a few more uses of `getPermissions`, but as pointed out above, these are usually flawed. In any case they can usually be replaced by openFile.
I have a perfectly OK use of getPermissions: in hmake, there is a routine that scans the PATH variable looking for an executable with a given name. Basically, it is a Haskell implementation of the unix 'which' command. There is no actual use of the executable, just a test to report/reject the candidate pathname.
You wouldn't be losing much by using doesFileExist rather than getPermissions. On Windows it turns out to be really hard if not impossible to check for execute permission - the only reliable way is to actually try to execute the file. The current getPermissions always returns True for execute permission on Windows, and the one in GHC 6.8.1 returns True if the filename ends in something like ".exe" or ".bat" (both are wrong, just wrong in different ways). Cheers, Simon