From: qrczak Date: Thu, 11 Jan 2001 22:04:39 +0000 (+0000) Subject: [project @ 2001-01-11 22:04:39 by qrczak] X-Git-Tag: Approximately_9120_patches~2940 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e19816a81ab6e73f8101edd46e4bd65d9f6fbfd2;p=ghc-hetmet.git [project @ 2001-01-11 22:04:39 by qrczak] Allow Ptr in foreign dynamic declarations --- diff --git a/ghc/compiler/prelude/TysWiredIn.lhs b/ghc/compiler/prelude/TysWiredIn.lhs index 73ef625..961325a 100644 --- a/ghc/compiler/prelude/TysWiredIn.lhs +++ b/ghc/compiler/prelude/TysWiredIn.lhs @@ -452,19 +452,19 @@ isFFIExportResultTy :: Type -> Bool isFFIExportResultTy ty = checkRepTyCon legalFEResultTyCon ty isFFIDynArgumentTy :: Type -> Bool --- The argument type of a foreign import dynamic must be either Addr, or --- a newtype of Addr. -isFFIDynArgumentTy = checkRepTyCon (== addrTyCon) +-- The argument type of a foreign import dynamic must be Ptr, Addr, +-- or a newtype of either. +isFFIDynArgumentTy = checkRepTyCon (\tc -> tc == ptrTyCon || tc == addrTyCon) isFFIDynResultTy :: Type -> Bool --- The result type of a foreign export dynamic must be either Addr, or --- a newtype of Addr. -isFFIDynResultTy = checkRepTyCon (== addrTyCon) +-- The result type of a foreign export dynamic must be Ptr, Addr, +-- or a newtype of either. +isFFIDynResultTy = checkRepTyCon (\tc -> tc == ptrTyCon || tc == addrTyCon) isFFILabelTy :: Type -> Bool --- The type of a foreign label must be either Addr, or --- a newtype of Addr. -isFFILabelTy = checkRepTyCon (\tc -> tc == addrTyCon || tc == ptrTyCon) +-- The type of a foreign label must be Ptr, Addr, +-- or a newtype of either. +isFFILabelTy = checkRepTyCon (\tc -> tc == ptrTyCon || tc == addrTyCon) checkRepTyCon :: (TyCon -> Bool) -> Type -> Bool -- look through newtypes