
Hi all, Proposal: Make Permissions type abstract Ticket: http://hackage.haskell.org/trac/ghc/ticket/4149 The Permissions type in System.Directory aims to be a lowest-common-denominator type. This makes it unsuitable for some tasks. For example, a copyPermissions primitive had to be implemented, as it is not possible to use the getPermissions and setPermissions functions to copy the permissions from one file to another: $ ls -l foo* -rwxr-x-wx 1 ian ian 0 Jun 23 21:27 foo1 ---------- 1 ian ian 0 Jun 23 21:27 foo2 ---------- 1 ian ian 0 Jun 23 21:27 foo3 $ hd -e 'System.Directory.copyPermissions "foo1" "foo2"' $ hd -e 'System.Directory.getPermissions "foo1" >>= System.Directory.setPermissions "foo3"' $ ls -l foo* -rwxr-x-wx 1 ian ian 0 Jun 23 21:27 foo1 -rwxr-x-wx 1 ian ian 0 Jun 23 21:27 foo2 -rwx------ 1 ian ian 0 Jun 23 21:27 foo3 I think we would be better served by the Permissions type being abstract in System.Directory, with the unix and Win32 packages providing the real definition, and some system-specific functions on it. This would allow the generic get/set functions to implement copyPermissions. This proposal just does the step which has most potential to cause problems for packages that use the type: It makes the type abstract in System.Directory (and adds explicit setter functions, so no functionality is lost). (patch is in the ticket) The type is also exported in Haskell 98's Directory module. I think this should get its own copy of the type. Suggested discussion deadline: 9 July 2010. Thanks Ian