summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Vector.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Internal/Vector.hs')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index c73ef10..7dd1289 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -322,8 +322,8 @@ zipVector f u v = unsafePerformIO $ do
322 322
323-- | unzipWith for Vectors 323-- | unzipWith for Vectors
324unzipVectorWith :: (Storable (a,b), Storable c, Storable d) 324unzipVectorWith :: (Storable (a,b), Storable c, Storable d)
325 => (a -> c) -> (b -> d) -> Vector (a,b) -> (Vector c,Vector d) 325 => ((a,b) -> (c,d)) -> Vector (a,b) -> (Vector c,Vector d)
326unzipVectorWith f g u = unsafePerformIO $ do 326unzipVectorWith f u = unsafePerformIO $ do
327 let n = dim u 327 let n = dim u
328 v <- createVector n 328 v <- createVector n
329 w <- createVector n 329 w <- createVector n
@@ -331,9 +331,10 @@ unzipVectorWith f g u = unsafePerformIO $ do
331 unsafeWith v $ \pv -> 331 unsafeWith v $ \pv ->
332 unsafeWith w $ \pw -> do 332 unsafeWith w $ \pw -> do
333 let go (-1) = return () 333 let go (-1) = return ()
334 go !k = do (x,y) <- peekElemOff pu k 334 go !k = do z <- peekElemOff pu k
335 pokeElemOff pv k (f x) 335 let (x,y) = f z
336 pokeElemOff pw k (g y) 336 pokeElemOff pv k x
337 pokeElemOff pw k y
337 go (k-1) 338 go (k-1)
338 go (n-1) 339 go (n-1)
339 return (v,w) 340 return (v,w)