summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--lib/Data/Packed/Internal/Vector.hs8
2 files changed, 4 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index ccb029c..90a8d74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@ index.html
17title.md 17title.md
18 18
19/base-reinstall.sh 19/base-reinstall.sh
20.cabal-sandbox
21cabal.sandbox.config
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 #-}