X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FdeSugar%2FDsForeign.lhs;h=462da0e051e5ab16bc115537cb321ecfbae48eaa;hp=5d47921c7e78b02a1be756c02f630901a14c89ac;hb=f1c0fd99f16322fe222c6fcf4626a6162ad0a466;hpb=a1433cc95b8165bab8c65090642577dd51720f1f diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs index 5d47921..462da0e 100644 --- a/compiler/deSugar/DsForeign.lhs +++ b/compiler/deSugar/DsForeign.lhs @@ -31,6 +31,7 @@ import Literal ( Literal(..), mkStringLit ) import Module ( moduleNameFS, moduleName ) import Name ( getOccString, NamedThing(..) ) import Type ( repType, coreEqType ) +import Coercion ( mkUnsafeCoercion ) import TcType ( Type, mkFunTys, mkForAllTys, mkTyConApp, mkFunTy, tcSplitTyConApp_maybe, tcSplitIOType_maybe, tcSplitForAllTys, tcSplitFunTys, tcTyConAppArgs, @@ -324,7 +325,7 @@ f :: Fun -> IO (FunPtr Fun) f cback = bindIO (newStablePtr cback) (\StablePtr sp# -> IO (\s1# -> - case _ccall_ createAdjustor cconv sp# ``f_helper'' s1# of + case _ccall_ createAdjustor cconv sp# ``f_helper'' s1# of (# s2#, a# #) -> (# s2#, A# a# #))) foreign import "&f_helper" f_helper :: FunPtr (StablePtr Fun -> Fun) @@ -402,8 +403,9 @@ dsFExportDynamic id cconv -- PlayRisky: the adjustor doesn't allocate in the Haskell heap or do a callback let ccall_adj_ty = exprType ccall_adj ccall_io_adj = mkLams [stbl_value] $ - Note (Coerce io_res_ty ccall_adj_ty) - ccall_adj + (pprTrace "DsForeign: why is there an unsafeCoerce here?" (text "") $ + (Cast ccall_adj (mkUnsafeCoercion ccall_adj_ty io_res_ty ))) + io_app = mkLams tvs $ mkLams [cback] $ stbl_app ccall_io_adj res_ty