#4149: Make Permissions type abstract
------------------------------------+---------------------------------------
    Reporter:  igloo                |        Owner:              
        Type:  proposal             |       Status:  new         
    Priority:  normal               |    Milestone:  Not GHC     
   Component:  libraries/directory  |      Version:  6.12.3      
    Keywords:                       |   Difficulty:              
          Os:  Unknown/Multiple     |     Testcase:              
Architecture:  Unknown/Multiple     |      Failure:  None/Unknown
------------------------------------+---------------------------------------
 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).

 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4149>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to