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(..) ) ...@@ -29,7 +29,8 @@ import ForeignCall ( ForeignCall, CCallTarget(..) )
import TcType ( tcSplitTyConApp_maybe ) import TcType ( tcSplitTyConApp_maybe )
import Type ( Type, isUnLiftedType, mkFunTys, mkFunTy, import Type ( Type, isUnLiftedType, mkFunTys, mkFunTy,
tyVarsOfType, mkForAllTys, mkTyConApp, tyVarsOfType, mkForAllTys, mkTyConApp,
isPrimitiveType, splitTyConApp_maybe, splitNewType_maybe isPrimitiveType, splitTyConApp_maybe,
splitNewType_maybe, splitForAllTy_maybe,
) )
import PrimOp ( PrimOp(..) ) import PrimOp ( PrimOp(..) )
...@@ -309,6 +310,14 @@ resultWrapper result_ty ...@@ -309,6 +310,14 @@ resultWrapper result_ty
in in
(maybe_ty, \e -> mkCoerce2 result_ty rep_ty (wrapper e)) (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 -- 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, | Just (tycon, tycon_arg_tys, data_con, data_con_arg_tys) <- splitProductType_maybe result_ty,
dataConSourceArity data_con == 1 dataConSourceArity data_con == 1
......
Supports Markdown
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