PROPOSAL: add tryFdSeek to unix

John Lato jwlato at
Wed Jun 29 21:02:34 CEST 2011

> > I'd like to propose adding a variant of fdSeek which returns errors
> > directly instead of throwing an exception.
> >
> Why wouldn't you just wrap it in Control.Exception.try instead? And what's
> so special about seeking that suggests that it needs an alternate entry
> point?

(Disclosure: I'm one of the people who requested this originally)

Wrapping a function like `fdSeek` in a `try` to get a non-exception variant
is wasteful.  Exceptions are a Haskell layer on top of the more fundamental
library call, and people who want access to that call directly shouldn't
have to unwrap extra cruft to do so.  Nor should they have to re-implement
basic functionality because the library doesn't expose it.

fdSeek just happens to be a current need of mine.  I would hope that this
approach would be adopted across the board.

> (In other words, I'm opposed to this proposal.)

 I'm opposed to exceptions, but there's no way to avoid them because the
library doesn't expose a direct interface.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list