[Haskell-cafe] Re: Complex C99 type in Foreign

Maurí­cio briqueabraque at yahoo.com
Fri Feb 13 19:28:16 EST 2009

>>>>>> Are there plans to include C99 'complex' type
>>>>>> in Foreign, maybe as CFloatComplex, CDoubleComplex
>>>>> A separate library for new types to add to Foreign would be the easiest
>>>>> way forward. Just put the foreign-c99 package on Hackage?
>>>> (...) I could actually have some
>>>> arbitrary sized parameter as argument to a function
>>>> or as a return value (and not its pointer), what
>>>> did I saw wrong? I understand only Foreign.C.C*
>>>> types or forall a. => Foreign.Ptr.Ptr a can be used
>>>> like that.
>>> Oh, you mean you need to teach the compiler about unboxed complex types?
>> I'm sorry, maybe I didn't understand you well. Are
>> you saying that I could get this 'CComplex' type using
>> unboxed types and other things already available?
> Yes, because the C standard guarantees that a complex <type> is
> stored as <type>[2].
> I have been using the following, for binding to FFTW:

The way you wrote CComplex a, is it possible to write

foreign import ccall "somename" somename
   :: CComplex CDouble -> IO CComplex CDouble



More information about the Haskell-Cafe mailing list