Permalink
Browse files

Add contructor for Strided vectors

  • Loading branch information...
1 parent 45d7177 commit 552b89cd4d3c832756c538090aa51509acaa161f @Shimuuar committed Aug 31, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 Data/Vector/Storable/Strided/Mutable.hs
@@ -14,6 +14,7 @@
module Data.Vector.Storable.Strided.Mutable (
MVector(..)
, stride
+ , unsafeFromForeignPtr
) where
import Control.Monad.Primitive
@@ -91,6 +92,15 @@ instance Storable a => M.MVector MVector a where
+-- | Create vector from raw pointer.
+unsafeFromForeignPtr :: Storable a
+ => Int -- ^ Length
+ -> Int -- ^ Stride
+ -> ForeignPtr a -- ^ Pointer to data
+ -> MVector s a
+{-# INLINE unsafeFromForeignPtr #-}
+unsafeFromForeignPtr = MVector
+
----------------------------------------------------------------

0 comments on commit 552b89c

Please sign in to comment.