summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-02-16 16:24:49 +0000
committerIan Lynagh <igloo@earth.li>2012-02-16 16:24:49 +0000
commita4b3fda552de6b26e132935866222cf63f815f0a (patch)
tree62784a21b66ec208e244323bcabe5b40d2498c30
parentd2377e86a97c68f43f04217ea8e3558571be6238 (diff)
downloadhaskell-a4b3fda552de6b26e132935866222cf63f815f0a.tar.gz
Add FunPtr to the types that toCType knows about
-rw-r--r--compiler/deSugar/DsForeign.lhs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs
index 64587ba880..55b2b234e3 100644
--- a/compiler/deSugar/DsForeign.lhs
+++ b/compiler/deSugar/DsForeign.lhs
@@ -669,10 +669,11 @@ showFFIType t = getOccString (getName (typeTyCon t))
toCType :: Type -> SDoc
toCType = f False
where f voidOK t
- -- First, if we have (Ptr t), then we need to convert t to a
- -- C type and put a * after it.
+ -- First, if we have (Ptr t) of (FunPtr t), then we need to
+ -- convert t to a C type and put a * after it. If we don't
+ -- know a type for t, then "void" is fine, though.
| Just (ptr, [t']) <- splitTyConApp_maybe t
- , tyConName ptr == ptrTyConName
+ , tyConName ptr `elem` [ptrTyConName, funPtrTyConName]
= f True t' <> char '*'
-- Otherwise, if we have a type constructor application, then
-- see if there is a C type associated with that constructor.