#2099: Storable instance for Complex
-------------------------+--------------------------------------------------
    Reporter:  jedbrown  |       Owner:                
        Type:  proposal  |      Status:  new           
    Priority:  normal    |   Component:  libraries/base
     Version:  6.8.2     |    Severity:  normal        
    Keywords:            |    Testcase:                
Architecture:  Multiple  |          Os:  Multiple      
-------------------------+--------------------------------------------------
 I propose that the following instance be added to base:

 {{{
 instance (RealFloat a, Storable a) => Storable (Complex a) where
     sizeOf z    = 2 * sizeOf (realPart z)
     alignment z = sizeOf (realPart z)
     peek p = do
         [r,i] <- peekArray 2 (castPtr p)
         return (r :+ i)
     poke p (r :+ i) = pokeArray (castPtr p) [r,i]
 }}}

 This instance is binary compatible with C99, C++ and Fortran complex
 types.

 It is currently needed by at least two independent packages: hmatrix and
 fft.  Since it is natural for user code to use both of these packages, we
 need to move the instance to a common location.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2099>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to