Skip to content
  • Simon Peyton Jones's avatar
    Allow IO to be wrapped in a newtype in foreign import/export · fb0f3349
    Simon Peyton Jones authored
    Up to now, the silent unwrapping of newtypes in foreign import/export
    has been limited to data values.  But it's useful for the IO monad
    itself:
    
    	newtype MyIO a = MIO (IO a)
    
    	foreign import foo :: Int -> MyIO Int
    
    This patch allows the IO monad to be
    wrapped too. This applies to foreign import "dynamic" and "wrapper", 
    thus
       foreign import "wrapper" foo :: MyIO () -> HisIO (FunPtr (MyIO ())) 
    
    Warning: I did on the plane, and I'm no longer sure if its 100% 
    complete, so needs more testing.  In particular the wrapper/dynamic bit.
    fb0f3349