Foreign.C.Error (original) (raw)
Haskell representations of errno
values
newtype Errno Source
Haskell representation for errno
values. The implementation is deliberately exposed, to allow users to add their own definitions of [Errno](Foreign-C-Error.html#t:Errno)
values.
Common errno
symbols
Different operating systems and/or C libraries often support different values of errno
. This module defines the common values, but due to the open definition of [Errno](Foreign-C-Error.html#t:Errno)
users may add definitions which are not predefined.
[Errno](Foreign-C-Error.html#t:Errno)
functions
Guards for IO operations that may fail
throwErrnoIfSource
Arguments
:: (a -> Bool) | predicate to apply to the result value of the IO operation |
---|---|
-> String | textual description of the location |
-> IO a | the IO operation to be executed |
-> IO a |
Throw an [IOError](System-IO-Error.html#t:IOError)
corresponding to the current value of [getErrno](Foreign-C-Error.html#v:getErrno)
if the result value of the [IO](System-IO.html#t:IO)
action meets the given predicate.
throwErrnoIfRetryMayBlockSource
Arguments
:: (a -> Bool) | predicate to apply to the result value of the IO operation |
---|---|
-> String | textual description of the location |
-> IO a | the IO operation to be executed |
-> IO b | action to execute before retrying if an immediate retry would block |
-> IO a |
as [throwErrnoIfRetry](Foreign-C-Error.html#v:throwErrnoIfRetry)
, but additionally if the operation yields the error code [eAGAIN](Foreign-C-Error.html#v:eAGAIN)
or [eWOULDBLOCK](Foreign-C-Error.html#v:eWOULDBLOCK)
, an alternative action is executed before retrying.