
On Thu, Feb 16, 2012 at 1:20 PM, Ian Lynagh
I've now implemented this in GHC. For now, the syntax is:
type {-# CTYPE "some C type" #-} Foo = ... newtype {-# CTYPE "some C type" #-} Foo = ... data {-# CTYPE "some C type" #-} Foo = ...
The magic for (Ptr a) is built in to the compiler.
Heh. I just added it for jhc too with the exact same syntax. :) the difference is that I do not allow them for 'type' declarations, as dusugaring of types happens very early in compilation, and it feels sort of wrong to give type synonyms meaning. like I'm breaking referential transparency or something.. I also allow foreign header declarations just like with ccall. data {-# CTYPE "stdio.h FILE" #-} CFile will mean that 'stdio.h' needs to be included for FILE to be declared. John