Why is System.Posix.Error in unix?

Ian Lynagh igloo at earth.li
Fri Jul 20 17:13:03 EDT 2007

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
> subsystem?

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!

> I.e. it's a unix interface.  Yes C proper defines some error numbers,
> but that's because C and Unix evolved together.  The ones defined in the
> C standard (as well as posix)
> EDOM -- argument out of domain for math function
> EILSEQ -- illegal byte sequence
> ERANGE -- "result too large"
> are all results from essentially pure library functions, and shouldn't
> need to throw IO errors.

Both the FFI spec and base:Foreign.C.Error also define many other error


More information about the Libraries mailing list