X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FdeSugar%2FDsForeign.lhs;h=462da0e051e5ab16bc115537cb321ecfbae48eaa;hb=55923428a9077c20b85ad2ea7c47197045831336;hp=5d47921c7e78b02a1be756c02f630901a14c89ac;hpb=16513d4899e167d20e120c2b3907230b7ff9dd83;p=ghc-hetmet.git 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