Haskell Core Libraries (base package)ParentContentsIndex
Foreign.Marshal.Error
Portability portable
Stability provisional
Maintainer ffi@haskell.org
Description
Marshalling support: Handling of common error conditions
Synopsis
throwIf :: (a -> Bool) -> (a -> String) -> IO a -> IO a
throwIf_ :: (a -> Bool) -> (a -> String) -> IO a -> IO ()
throwIfNeg :: (Ord a, Num a) => (a -> String) -> IO a -> IO a
throwIfNeg_ :: (Ord a, Num a) => (a -> String) -> IO a -> IO ()
throwIfNull :: String -> IO (Ptr a) -> IO (Ptr a)
void :: IO a -> IO ()
Error utilities
Throw an exception on specific return values
throwIf :: (a -> Bool) -> (a -> String) -> IO a -> IO a

Guard an IO operation and throw an exception if the result meets the given predicate

  • the second argument computes an error message from the result of the IO operation

throwIf_ :: (a -> Bool) -> (a -> String) -> IO a -> IO ()
Like throwIf, but discarding the result
throwIfNeg :: (Ord a, Num a) => (a -> String) -> IO a -> IO a
Guards against negative result values
throwIfNeg_ :: (Ord a, Num a) => (a -> String) -> IO a -> IO ()
Like throwIfNeg, but discarding the result
throwIfNull :: String -> IO (Ptr a) -> IO (Ptr a)
Guards against null pointers
void :: IO a -> IO ()
Discard the return value of an IO action
Produced by Haddock version 0.4