summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
authorsegfault <s9gf4ult@gmail.com>2013-12-22 21:56:01 +0600
committersegfault <s9gf4ult@gmail.com>2013-12-22 21:56:01 +0600
commit7031e63e3dca98a4769461f97bc5b68157fd5ccb (patch)
tree10fba091ef01c6922f39cbfa7ac50bab6447535c /lib/Data
parenta318dd7efdd5b50196e65467108894969b3be810 (diff)
reimport Vector.fromList instead own implementation
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs8
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 (
34import Data.Packed.Internal.Common 34import Data.Packed.Internal.Common
35import Data.Packed.Internal.Signatures 35import Data.Packed.Internal.Signatures
36import Foreign.Marshal.Alloc(free) 36import Foreign.Marshal.Alloc(free)
37import Foreign.Marshal.Array(peekArray, pokeArray, copyArray, advancePtr) 37import Foreign.Marshal.Array(peekArray, copyArray, advancePtr)
38import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) 38import Foreign.ForeignPtr(ForeignPtr, castForeignPtr)
39import Foreign.Ptr(Ptr) 39import Foreign.Ptr(Ptr)
40import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) 40import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf)
@@ -57,6 +57,7 @@ import GHC.IOBase hiding (liftIO)
57 57
58import qualified Data.Vector.Storable as Vector 58import qualified Data.Vector.Storable as Vector
59import Data.Vector.Storable(Vector, 59import 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
1024 |> [2.0,3.0,5.0,7.0]@ 1034 |> [2.0,3.0,5.0,7.0]@
103 104
104-} 105-}
105fromList :: Storable a => [a] -> Vector a
106fromList l = unsafePerformIO $ do
107 v <- createVector (length l)
108 unsafeWith v $ \ p -> pokeArray p l
109 return v
110 106
111safeRead v = inlinePerformIO . unsafeWith v 107safeRead v = inlinePerformIO . unsafeWith v
112{-# INLINE safeRead #-} 108{-# INLINE safeRead #-}