[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

Maurí­cio briqueabraque at yahoo.com
Wed Jul 1 22:40:19 EDT 2009

>> * CComplexFloat, CComplexDouble
>>     Related to 'float complex' and 'double complex'.
> We need a way to actually examine the values, since 'fromIntegral' won't
> work. I think the easiest way is to actually reuse Complex which is
> already in Haskell 98, defining

What do you think of

newtype CComplexFloat = CComplexFloat {crealf, cimagf :: CFloat}

'crealf' and 'cimagf' actually belong to the standard, and
are supposed to be used to read the real and imaginary part
of a float complex. There are also 'creal', 'cimag', 'creall',
'cimagl' that we would use in CComplexDouble and CComplexLDouble.

> We may also want to add 'long double' as a c marshable type too.

I think it's already there. Isn't it CLDouble?


More information about the Haskell-Cafe mailing list