File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
unison-runtime/src/Unison/Runtime/Foreign Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 22
33module Unison.Runtime.Foreign.Dynamic where
44
5- import Control.Monad (unless )
65import Control.Exception
6+ import Control.Monad (unless )
77import Data.Tagged (Tagged (.. ))
88import Foreign.ForeignPtr
99import Foreign.LibFFI.FFITypes
@@ -66,7 +66,8 @@ encodeTypes (t : ts) !p = do
6666 where
6767 sz = Store. sizeOf (undefined :: Ptr CType )
6868
69- data PrepException = BadVoid | BadInit deriving Show
69+ data PrepException = BadVoid | BadInit deriving (Show )
70+
7071instance Exception PrepException
7172
7273adjustSpec :: FFSpec -> IO FFSpec
Original file line number Diff line number Diff line change @@ -1169,12 +1169,12 @@ foreignCallHelper = \case
11691169 FFI_getDLLSym -> mkForeignExn $ \ (dll, sym, spec) ->
11701170 let name = getDLLPath dll ++ " $" ++ sym
11711171 n = length $ ffArgs spec
1172- in catchLoad name do
1173- df <- loadForeign dll spec sym
1174- let dummyRef = Builtin . Data.Text. pack $ cName df
1175- dummyCix = CIx dummyRef maxBound 0
1176- comb = LamI (n + 1 ) (n + 2 ) (Ins DLLCall . Yield $ VArg1 0 )
1177- evaluate $ PApV dummyCix comb [encodeVal df]
1172+ in catchLoad name do
1173+ df <- loadForeign dll spec sym
1174+ let dummyRef = Builtin . Data.Text. pack $ cName df
1175+ dummyCix = CIx dummyRef maxBound 0
1176+ comb = LamI (n + 1 ) (n + 2 ) (Ins DLLCall . Yield $ VArg1 0 )
1177+ evaluate $ PApV dummyCix comb [encodeVal df]
11781178 where
11791179 forceListSpine xs = foldl (\ u x -> x `seq` u) xs xs
11801180 chop = reverse . dropWhile isPathSeparator . reverse
@@ -1206,8 +1206,8 @@ foreignCallHelper = \case
12061206 where
12071207 io :: IOException -> IO (Either (F. Failure Val ) a )
12081208 io ex =
1209- pure . Left
1210- $ F. Failure Ty. ioFailureRef (pack $ show ex) unitValue
1209+ pure . Left $
1210+ F. Failure Ty. ioFailureRef (pack $ show ex) unitValue
12111211
12121212 prep :: PrepException -> IO (Either (F. Failure Val ) a )
12131213 prep BadVoid =
You can’t perform that action at this time.
0 commit comments