From 7031e63e3dca98a4769461f97bc5b68157fd5ccb Mon Sep 17 00:00:00 2001 From: segfault Date: Sun, 22 Dec 2013 21:56:01 +0600 Subject: reimport Vector.fromList instead own implementation --- .gitignore | 2 ++ lib/Data/Packed/Internal/Vector.hs | 8 ++------ 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 title.md /base-reinstall.sh +.cabal-sandbox +cabal.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 ( import Data.Packed.Internal.Common import Data.Packed.Internal.Signatures import Foreign.Marshal.Alloc(free) -import Foreign.Marshal.Array(peekArray, pokeArray, copyArray, advancePtr) +import Foreign.Marshal.Array(peekArray, copyArray, advancePtr) import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) import Foreign.Ptr(Ptr) import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) @@ -57,6 +57,7 @@ import GHC.IOBase hiding (liftIO) import qualified Data.Vector.Storable as Vector import Data.Vector.Storable(Vector, + fromList, unsafeToForeignPtr, unsafeFromForeignPtr, unsafeWith) @@ -102,11 +103,6 @@ createVector n = do 4 |> [2.0,3.0,5.0,7.0]@ -} -fromList :: Storable a => [a] -> Vector a -fromList l = unsafePerformIO $ do - v <- createVector (length l) - unsafeWith v $ \ p -> pokeArray p l - return v safeRead v = inlinePerformIO . unsafeWith v {-# INLINE safeRead #-} -- cgit v1.2.3