X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=EsounD.git;a=blobdiff_plain;f=Sound%2FEsounD%2FInternals.hs;h=735ce6324762dd14672a688df383b65515e6e727;hp=f4b067f0903cf30fc9a23b62ccb13dee41c5e4fe;hb=080d77f8aece1d14f71f6fd337f0cda9cdf7d740;hpb=808cc2f4700bc0b2f77cee443dd237d415b4d5d7 diff --git a/Sound/EsounD/Internals.hs b/Sound/EsounD/Internals.hs index f4b067f..735ce63 100644 --- a/Sound/EsounD/Internals.hs +++ b/Sound/EsounD/Internals.hs @@ -28,7 +28,6 @@ import Foreign.C.String import Foreign.C.Types import Foreign.Ptr import Foreign.Storable -import Prelude.Unicode import System.IO import System.Posix.IO import System.Posix.Types @@ -99,7 +98,7 @@ withCStrOrNull ∷ Maybe String → (CString → IO a) → IO a withCStrOrNull Nothing f = f nullPtr withCStrOrNull (Just s) f = withCString s f -failOnError ∷ Monad m ⇒ String → CInt → m () -failOnError msg rv - | rv ≤ 0 = fail msg - | otherwise = return () +failOnError ∷ Monad m ⇒ String → (CInt → Bool) → CInt → m CInt +failOnError msg isErr rv + | isErr rv = fail msg + | otherwise = return rv