hslua 0.3.5 → 0.3.6
raw patch · 2 files changed
+5/−4 lines, 2 files
Files
- hslua.cabal +1/−1
- src/Scripting/Lua.hs +4/−3
hslua.cabal view
@@ -1,5 +1,5 @@ Name: hslua-Version: 0.3.5+Version: 0.3.6 Stability: beta Cabal-version: >= 1.6 License: BSD3
src/Scripting/Lua.hs view
@@ -1,5 +1,5 @@ -{-# LANGUAGE ForeignFunctionInterface, TypeSynonymInstances, FlexibleInstances #-} +{-# LANGUAGE ForeignFunctionInterface, TypeSynonymInstances, FlexibleInstances, ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing -fno-warn-unused-do-bind -fno-warn-unused-binds #-} -- | -- Module : Scripting.Lua @@ -176,11 +176,12 @@ registerhsfunction ) where -import Prelude hiding (concat) +import Prelude hiding (concat, catch) import Foreign.C import Foreign.Ptr import Foreign.StablePtr import Control.Monad +import Control.Exception import Foreign.Marshal.Alloc import Data.IORef import qualified Foreign.Storable as F @@ -961,7 +962,7 @@ -- Any Haskell exception will be converted to a string and returned -- as Lua error. luaimport :: LuaImport a => a -> LuaCFunction -luaimport a l = luaimport' 1 a l `catch` (\e -> push l (show e) >> return (-1)) +luaimport a l = luaimport' 1 a l `catch` (\(e :: IOError) -> push l (show e) >> return (-1)) -- | Free function pointer created with @newcfunction@. freecfunction :: FunPtr LuaCFunction -> IO ()