diff options
author | Jed Brown <jed@59A2.org> | 2008-02-17 16:22:34 +0000 |
---|---|---|
committer | Jed Brown <jed@59A2.org> | 2008-02-17 16:22:34 +0000 |
commit | 003b8db7a864bbea3772cd70906153bd36d1f7ac (patch) | |
tree | 2336c052eb549d21fdd30ba068676010193b7e57 /lib | |
parent | 63cfdd6dd1b31a303147f26cf72481640f962a3c (diff) |
Get Storable instance for Complex from storable-complex.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Common.hs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs index 5ac4f5a..baeb5bc 100644 --- a/lib/Data/Packed/Internal/Common.hs +++ b/lib/Data/Packed/Internal/Common.hs | |||
@@ -22,16 +22,8 @@ import Control.Monad(when) | |||
22 | import Debug.Trace | 22 | import Debug.Trace |
23 | import Foreign.C.String(peekCString) | 23 | import Foreign.C.String(peekCString) |
24 | import Foreign.C.Types | 24 | import Foreign.C.Types |
25 | import Foreign.Storable.Complex | ||
25 | 26 | ||
26 | ---------------------------------------------------------------------- | ||
27 | instance (Storable a, RealFloat a) => Storable (Complex a) where -- | ||
28 | alignment x = alignment (realPart x) -- | ||
29 | sizeOf x = 2 * sizeOf (realPart x) -- | ||
30 | peek p = do -- | ||
31 | [re,im] <- peekArray 2 (castPtr p) -- | ||
32 | return (re :+ im) -- | ||
33 | poke p (a :+ b) = pokeArray (castPtr p) [a,b] -- | ||
34 | ---------------------------------------------------------------------- | ||
35 | 27 | ||
36 | -- | @debug x = trace (show x) x@ | 28 | -- | @debug x = trace (show x) x@ |
37 | debug :: (Show a) => a -> a | 29 | debug :: (Show a) => a -> a |