Why is System.Posix.Error in unix?
simonmarhaskell at gmail.com
Tue Jul 24 04:14:31 EDT 2007
Ian Lynagh wrote:
> On Fri, Jul 20, 2007 at 05:20:36PM +0000, Aaron Denney wrote:
>> On 2007-07-19, Ian Lynagh <igloo at earth.li> wrote:
>>> I get the feeling I must be missing something, but why is
>>> System.Posix.Error in the unix package? It looks to me like it just
>>> calls things in the base package, and it works on Windows as far as I
>>> can see:
>> Because it's about the Posix "errno" interface, and nobody uses the
>> posix subsystem of windows because it doesn't interact well with the GUI
> That might make sense to me, except the getErrno function that actually
> gets the errorno is in base:Foreign.C.Error, and it (well, under the
> non-hierarchical name CError) is specified in the FFI spec.
> In fact, now I look more closely, it also defines a number of
> throwErrno* functions; it's only the throwErrnoPath* functions that are
> in unix:System.Posix.Error. This all seems very odd!
errno is defined by C99 (as well as POSIX), so it's reasonable to put
errno-related stuff in Foreign.C.Error. When I needed to add some
error-related functionality for the POSIX library, I didn't want to add
extra stuff to Foreign.C.Error beyond what was specified in the FFI spec,
so I added System.Posix.Error instead. This was just conservative; we
could probably add throwErrnoPath and friends to Foreign.C.Error (with the
usual proposal process).
More information about the Libraries