Unavailable system functions in `unix` (was: Pull request for inclusion in `unix' module of fsync(2), fdatasync(2), posix_fadvise(2) and posix_fallocate(2))

Ben Millwood haskell at benmachine.co.uk
Sat Dec 28 00:11:40 UTC 2013

On Sun, Dec 22, 2013 at 12:02:16PM -0800, John Lato wrote:
>On Dec 22, 2013 7:28 AM, "Herbert Valerio Riedel" <hvr at gnu.org> wrote:
>> On 2013-12-22 at 11:32:20 +0100, Thomas Schilling wrote:
>> > Either I should be able to check at compile time, or I should get a
>> > defined exception call which then must be handled by the library.  In
>> > either case it should be documented with the function.
>> It might be worth adding more information to the Haddock-comments
>> mentioning the respective `HAVE_*` CPP symbol and whether a
>> fallback-implementation is used.
>> Moreover, the use of `error` to signal non-existing implementations
>> could be reconsidered (e.g. maybe switch to a properly thrown
>> "call-not-implemented" exception)
>This would definitely be better than calling error. Personally I would
>prefer conditional exports, as it would turn up errors sooner.
>John L.

What does client code look like, if this is your implementation 
strategy? Note that the network package recently changed to *stop* 
conditionally exporting things, because it led to bad error messages 
(yes, your error is caught at compile time, but it's not so clear what 
it *is*) and ugly client code. See e.g. 

More information about the Libraries mailing list