Commit c3c29616 authored by simonmar's avatar simonmar
Browse files

[project @ 2003-01-23 16:13:43 by simonmar]

We have to desugar polymorphic FFI declarations properly, too.
(companion commit to rev. 1.84 of TcType.lhs).
parent 6873f3d4
......@@ -29,7 +29,8 @@ import ForeignCall ( ForeignCall, CCallTarget(..) )
import TcType ( tcSplitTyConApp_maybe )
import Type ( Type, isUnLiftedType, mkFunTys, mkFunTy,
tyVarsOfType, mkForAllTys, mkTyConApp,
isPrimitiveType, splitTyConApp_maybe, splitNewType_maybe
isPrimitiveType, splitTyConApp_maybe,
splitNewType_maybe, splitForAllTy_maybe,
)
import PrimOp ( PrimOp(..) )
......@@ -309,6 +310,14 @@ resultWrapper result_ty
in
(maybe_ty, \e -> mkCoerce2 result_ty rep_ty (wrapper e))
-- The type might contain foralls (eg. for dummy type arguments,
-- referring to 'Ptr a' is legal).
| Just (tyvar, rest) <- splitForAllTy_maybe result_ty
= let
(maybe_ty, wrapper) = resultWrapper rest
in
(maybe_ty, \e -> Lam tyvar (wrapper e))
-- Data types with a single constructor, which has a single arg
| Just (tycon, tycon_arg_tys, data_con, data_con_arg_tys) <- splitProductType_maybe result_ty,
dataConSourceArity data_con == 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment