Allow IO to be wrapped in a newtype in foreign import/export
authorsimonpj@microsoft.com <unknown>
Tue, 11 Apr 2006 12:04:41 +0000 (12:04 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 11 Apr 2006 12:04:41 +0000 (12:04 +0000)
commitfb0f3349561dd4493d81ca7c3a140b37fa0dc0de
tree58b722d751a1f05404b2a034a5e0f0632fb97f85
parentaa2c486e51caa0386aaff0d1b866a60316500b41
Allow IO to be wrapped in a newtype in foreign import/export

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.
compiler/deSugar/DsCCall.lhs
compiler/deSugar/DsForeign.lhs
compiler/typecheck/TcForeign.lhs
compiler/typecheck/TcType.lhs