Skip to content

foreign export doesn't deal with newtypes correctly

GHC does not accept foreign export dynamic where the result is not
Addr but a newtype for Addr. I think it should:

module M1 where
import Foreign
newtype FunPtr a = FunPtr Addr
foreign export dynamic f :: (Int -> Int) -> IO (FunPtr (Int -> Int))

Moreover, foreign export dynamic does not work with the NCG.

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/            GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-

Trac metadata
Trac field Value
Version None
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedFixed
Component Compiler (FFI)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information