diff options
Diffstat (limited to 'libraries/base/Foreign')
-rw-r--r-- | libraries/base/Foreign/C/Error.hs | 18 | ||||
-rw-r--r-- | libraries/base/Foreign/Marshal/Utils.hs | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/libraries/base/Foreign/C/Error.hs b/libraries/base/Foreign/C/Error.hs index 6d3ef80842..76ebe272ce 100644 --- a/libraries/base/Foreign/C/Error.hs +++ b/libraries/base/Foreign/C/Error.hs @@ -401,34 +401,36 @@ throwErrnoIfRetryMayBlock_ pred loc f on_block -- | Throw an 'IOError' corresponding to the current value of 'getErrno' -- if the 'IO' action returns a result of @-1@. -- -throwErrnoIfMinus1 :: Num a => String -> IO a -> IO a +throwErrnoIfMinus1 :: (Eq a, Num a) => String -> IO a -> IO a throwErrnoIfMinus1 = throwErrnoIf (== -1) -- | as 'throwErrnoIfMinus1', but discards the result. -- -throwErrnoIfMinus1_ :: Num a => String -> IO a -> IO () +throwErrnoIfMinus1_ :: (Eq a, Num a) => String -> IO a -> IO () throwErrnoIfMinus1_ = throwErrnoIf_ (== -1) -- | Throw an 'IOError' corresponding to the current value of 'getErrno' -- if the 'IO' action returns a result of @-1@, but retries in case of -- an interrupted operation. -- -throwErrnoIfMinus1Retry :: Num a => String -> IO a -> IO a +throwErrnoIfMinus1Retry :: (Eq a, Num a) => String -> IO a -> IO a throwErrnoIfMinus1Retry = throwErrnoIfRetry (== -1) -- | as 'throwErrnoIfMinus1', but discards the result. -- -throwErrnoIfMinus1Retry_ :: Num a => String -> IO a -> IO () +throwErrnoIfMinus1Retry_ :: (Eq a, Num a) => String -> IO a -> IO () throwErrnoIfMinus1Retry_ = throwErrnoIfRetry_ (== -1) -- | as 'throwErrnoIfMinus1Retry', but checks for operations that would block. -- -throwErrnoIfMinus1RetryMayBlock :: Num a => String -> IO a -> IO b -> IO a +throwErrnoIfMinus1RetryMayBlock :: (Eq a, Num a) + => String -> IO a -> IO b -> IO a throwErrnoIfMinus1RetryMayBlock = throwErrnoIfRetryMayBlock (== -1) -- | as 'throwErrnoIfMinus1RetryMayBlock', but discards the result. -- -throwErrnoIfMinus1RetryMayBlock_ :: Num a => String -> IO a -> IO b -> IO () +throwErrnoIfMinus1RetryMayBlock_ :: (Eq a, Num a) + => String -> IO a -> IO b -> IO () throwErrnoIfMinus1RetryMayBlock_ = throwErrnoIfRetryMayBlock_ (== -1) -- | Throw an 'IOError' corresponding to the current value of 'getErrno' @@ -481,13 +483,13 @@ throwErrnoPathIfNull = throwErrnoPathIf (== nullPtr) -- | as 'throwErrnoIfMinus1', but exceptions include the given path when -- appropriate. -- -throwErrnoPathIfMinus1 :: Num a => String -> FilePath -> IO a -> IO a +throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a throwErrnoPathIfMinus1 = throwErrnoPathIf (== -1) -- | as 'throwErrnoIfMinus1_', but exceptions include the given path when -- appropriate. -- -throwErrnoPathIfMinus1_ :: Num a => String -> FilePath -> IO a -> IO () +throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> FilePath -> IO a -> IO () throwErrnoPathIfMinus1_ = throwErrnoPathIf_ (== -1) -- conversion of an "errno" value into IO error diff --git a/libraries/base/Foreign/Marshal/Utils.hs b/libraries/base/Foreign/Marshal/Utils.hs index d3ab1fd057..ba8afccc32 100644 --- a/libraries/base/Foreign/Marshal/Utils.hs +++ b/libraries/base/Foreign/Marshal/Utils.hs @@ -108,7 +108,7 @@ fromBool True = 1 -- |Convert a Boolean in numeric representation to a Haskell value -- -toBool :: Num a => a -> Bool +toBool :: (Eq a, Num a) => a -> Bool toBool = (/= 0) |