 -- Returns a function handle
 --
 getFun :: Module -> String -> IO Fun
-getFun mdl fn = resultIfOk =<< cuModuleGetFunction mdl fn
+getFun mdl fn = resultIfFound "function" fn =<< cuModuleGetFunction mdl fn
 
 {# fun unsafe cuModuleGetFunction
   { alloca-      `Fun'    peekFun*

getPtr :: Module -> String -> IO (DevicePtr a, Int)
getPtr mdl name = do
  (status,dptr,bytes) <- cuModuleGetGlobal mdl name
  resultIfOk (status,(dptr,bytes))

{# fun unsafe cuModuleGetGlobal
  { alloca-      `DevicePtr a' peekDeviceHandle*

-- Return a handle to a texture reference
--
getTex :: Module -> String -> IO Texture
getTex mdl name = resultIfFound "texture" name =<< cuModuleGetTexRef mdl name

{# fun unsafe cuModuleGetTexRef
  { alloca-      `Texture' peekTex*
