[project @ 2000-12-08 21:28:15 by qrczak]
authorqrczak <unknown>
Fri, 8 Dec 2000 21:28:15 +0000 (21:28 +0000)
committerqrczak <unknown>
Fri, 8 Dec 2000 21:28:15 +0000 (21:28 +0000)
Let newtypes in stub files generate correct C type names.
It worked in ghc-4.09 but was not merged into 4.11?

ghc/compiler/deSugar/DsForeign.lhs

index a1f34d6..65ddba6 100644 (file)
@@ -29,7 +29,8 @@ import Name           ( mkGlobalName, nameModule, nameOccName, getOccString,
                          mkForeignExportOcc, isLocalName,
                          NamedThing(..),
                        )
-import Type            ( splitTyConApp_maybe, tyConAppTyCon, splitFunTys, splitForAllTys,
+import Type            ( repType, splitTyConApp_maybe,
+                         tyConAppTyCon, splitFunTys, splitForAllTys,
                          Type, mkFunTys, mkForAllTys, mkTyConApp,
                          mkFunTy, splitAppTy, applyTy, funResultTy
                        )
@@ -486,5 +487,9 @@ showStgType :: Type -> SDoc
 showStgType t = text "Hs" <> text (showFFIType t)
 
 showFFIType :: Type -> String
-showFFIType t = getOccString (getName (tyConAppTyCon t))
+showFFIType t = getOccString (getName tc)
+ where
+  tc = case splitTyConApp_maybe (repType t) of
+           Just (tc,_) -> tc
+           Nothing     -> pprPanic "showFFIType" (ppr t)
 \end{code}