 -- Return the results of a function on successful execution, otherwise return
 -- the error string associated with the return code
 --
-resultIfOk :: (Status, a) -> Either String a
+resultIfOk :: (Status, a) -> IO a
 resultIfOk (status,result) =
     case status of
-        Success -> Right result
-        _       -> Left (describe status)
+        Success -> return  result
+        _       -> throwIO (ExitCode status)
 
 
 -- |
 -- Return the error string associated with an unsuccessful return code,
 -- otherwise Nothing
 --
-nothingIfOk :: Status -> Maybe String
-nothingIfOk = nothingIf (== Success) describe
+nothingIfOk :: Status -> IO ()
+nothingIfOk status =
+    case status of
+        Success -> return  ()
+        _       -> throwIO (ExitCode status)
 

    with prefix="cudaError" deriving (Eq, Show) #}

--------------------------------------------------------------------------------
-- Functions
--------------------------------------------------------------------------------

-- |

--------------------------------------------------------------------------------

module Foreign.CUDA.Runtime.Error
  where


-- Friends
import Foreign.CUDA.Internal.C2HS

-- System
import Foreign
import Foreign.C
import Data.Typeable
import Control.Exception

#include <cuda_runtime_api.h>
{# context lib="cudart" #}


--------------------------------------------------------------------------------
-- Return Status
--------------------------------------------------------------------------------

--
