[Haskell-cafe] CPP and INLINE pragmas

Isaac Dupree isaacdupree at charter.net
Sun Jan 20 17:19:03 EST 2008


Adam Langley wrote:
> Since CPP mode removes newlines in the out macro expansion. It appears
> to be impossible to have a macro expand to a function with an INLINE
> pragma since it appears to need to be in its own line.

that's because INLINE uses layout like everything else, so you can use 
semicolons for it too.

> For example:
> 
> #define GETHOSTWORD(name, m, type) \
> {-# INLINE name #-} \
> name :: m type ; \
> name = getPtr (sizeOf (undefined :: type)) \
> 

something like

#define GETHOSTWORD(name, m, type) \
{-# INLINE name #-} ; \
name :: m type ; \
name = getPtr (sizeOf (undefined :: type)) \


~Isaac


More information about the Haskell-Cafe mailing list