diff options
author | Alberto Ruiz <aruiz@um.es> | 2013-12-24 08:14:14 -0800 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2013-12-24 08:14:14 -0800 |
commit | 4382cadadfb4b9312c49fa5fe51537f60a7e2f54 (patch) | |
tree | 10fba091ef01c6922f39cbfa7ac50bab6447535c /lib | |
parent | a318dd7efdd5b50196e65467108894969b3be810 (diff) | |
parent | 7031e63e3dca98a4769461f97bc5b68157fd5ccb (diff) |
Merge pull request #56 from s9gf4ult/master
reimport Vector.fromList instead of own implementation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index 5892e67..85e7f4f 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -34,7 +34,7 @@ module Data.Packed.Internal.Vector ( | |||
34 | import Data.Packed.Internal.Common | 34 | import Data.Packed.Internal.Common |
35 | import Data.Packed.Internal.Signatures | 35 | import Data.Packed.Internal.Signatures |
36 | import Foreign.Marshal.Alloc(free) | 36 | import Foreign.Marshal.Alloc(free) |
37 | import Foreign.Marshal.Array(peekArray, pokeArray, copyArray, advancePtr) | 37 | import Foreign.Marshal.Array(peekArray, copyArray, advancePtr) |
38 | import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) | 38 | import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) |
39 | import Foreign.Ptr(Ptr) | 39 | import Foreign.Ptr(Ptr) |
40 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) | 40 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) |
@@ -57,6 +57,7 @@ import GHC.IOBase hiding (liftIO) | |||
57 | 57 | ||
58 | import qualified Data.Vector.Storable as Vector | 58 | import qualified Data.Vector.Storable as Vector |
59 | import Data.Vector.Storable(Vector, | 59 | import Data.Vector.Storable(Vector, |
60 | fromList, | ||
60 | unsafeToForeignPtr, | 61 | unsafeToForeignPtr, |
61 | unsafeFromForeignPtr, | 62 | unsafeFromForeignPtr, |
62 | unsafeWith) | 63 | unsafeWith) |
@@ -102,11 +103,6 @@ createVector n = do | |||
102 | 4 |> [2.0,3.0,5.0,7.0]@ | 103 | 4 |> [2.0,3.0,5.0,7.0]@ |
103 | 104 | ||
104 | -} | 105 | -} |
105 | fromList :: Storable a => [a] -> Vector a | ||
106 | fromList l = unsafePerformIO $ do | ||
107 | v <- createVector (length l) | ||
108 | unsafeWith v $ \ p -> pokeArray p l | ||
109 | return v | ||
110 | 106 | ||
111 | safeRead v = inlinePerformIO . unsafeWith v | 107 | safeRead v = inlinePerformIO . unsafeWith v |
112 | {-# INLINE safeRead #-} | 108 | {-# INLINE safeRead #-} |