packages feed

repa-bytestring 2.2.0.1 → 3.0.0.1

raw patch · 3 files changed

+5/−113 lines, 3 filesdep −bytestringdep −vectordep ~repa

Dependencies removed: bytestring, vector

Dependency ranges changed: repa

Files

− Data/Array/Repa/ByteString.hs
@@ -1,101 +0,0 @@-{-# LANGUAGE ScopedTypeVariables, PackageImports #-}---- | Conversions between Repa Arrays and ByteStrings.-module Data.Array.Repa.ByteString-	( toByteString-	, fromByteString-	, copyFromPtrWord8-	, copyToPtrWord8)-where-import Data.Word-import Data.Array.Repa-import Foreign.Marshal.Alloc-import Foreign.Ptr-import Foreign.Storable-import System.IO.Unsafe-import qualified Data.Vector.Unboxed	as V-import qualified Data.ByteString	as BS-import Data.ByteString			(ByteString)----- | Copy an `Array` to a (strict) `ByteString`.-toByteString -	:: Shape sh-	=> Array sh Word8-	-> ByteString--{-# NOINLINE toByteString #-}-toByteString arr- =  withManifest' (force arr) $ \arr' - -> unsafePerformIO- $ allocaBytes (size $ extent arr')	$ \(bufDest :: Ptr Word8) ->-   let 	vec	= toVector arr'-	len	= size $ extent arr'--	copy offset-	 | offset >= len-	 = return ()--	 | otherwise-	 = do	pokeByteOff bufDest offset (vec `V.unsafeIndex` offset)-		copy (offset + 1)--    in do-	copy 0-	BS.packCStringLen (castPtr bufDest, len)----- | Copy a (strict) `ByteString` to a new `Array`.---	The given array extent must match the length of the `ByteString`, else `error`.-fromByteString -	:: Shape sh-	=> sh-	-> ByteString -	-> Array sh Word8---- TODO: Use an intermediate CString when we do this, to avoid---	 the overhead from bounds checks in ByteString-fromByteString sh str-	| size sh /= BS.length str-	= error "Data.Array.Repa.fromByteString: given array size does not match length of string"-	-	| otherwise-	= fromFunction sh (\ix -> str `BS.index` toIndex sh ix)----- Ptr utils --------------------------------------------------------------------- | Copy some data from somewhere into a new `Array`.-copyFromPtrWord8 -	:: Shape sh-	=> sh-	-> Ptr Word8-	-> IO (Array sh Word8)--{-# INLINE copyFromPtrWord8 #-}	-copyFromPtrWord8 sh ptr- = do	return	$ fromFunction sh (\ix -> unsafePerformIO (peekElemOff ptr (toIndex sh ix)))----- | Copy array data somewhere.s-copyToPtrWord8 -	:: Shape sh-	=> Ptr Word8-	-> Array sh Word8-	-> IO ()-	-{-# INLINE copyToPtrWord8 #-}-copyToPtrWord8 ptr arr- = let	vec	= toVector arr-	len	= size $ extent arr-	-	copy offset-	 | offset >= len-	 = return ()-	-	 | otherwise-	 = do	pokeByteOff ptr offset (vec `V.unsafeIndex` offset)-		copy (offset + 1)--   in do-	copy 0-	return ()
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2010, University of New South Wales.+Copyright (c) 2010-2012, University of New South Wales. All rights reserved.  Redistribution and use in source and binary forms, with or without
repa-bytestring.cabal view
@@ -1,5 +1,5 @@ Name:                repa-bytestring-Version:             2.2.0.1+Version:             3.0.0.1 License:             BSD3 License-file:        LICENSE Author:              The DPH Team@@ -10,22 +10,15 @@ Category:            Data Structures Homepage:            http://repa.ouroborus.net Bug-reports:         repa@ouroborus.net-Description:-        Conversions between Repa Arrays and ByteStrings.--Synopsis:-        Conversions between Repa Arrays and ByteStrings.+Description:         (deprecated)+Synopsis:            (deprecated)  Library   Build-Depends:          base                 == 4.*,-        repa                 == 2.2.*,-        vector               == 0.9.*,-        bytestring           == 0.9.*+        repa                 == 3.0.*    ghc-options:         -Odph -Wall -fno-warn-missing-signatures -  Exposed-modules:-        Data.Array.Repa.ByteString