Fix bug in unstreamR
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 10 Dec 2009 06:21:32 +0000 (06:21 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 10 Dec 2009 06:21:32 +0000 (06:21 +0000)
Data/Vector/Generic/Mutable.hs

index fd9aae1..857685e 100644 (file)
@@ -484,8 +484,8 @@ unstreamRMax s n
       let put i x = do
                       let i' = i-1
                       INTERNAL_CHECK(checkIndex) "unstreamRMax" i' n
-                        $ unsafeWrite v i x
-                      return i
+                        $ unsafeWrite v i' x
+                      return i'
       i <- Stream.foldM' put n s
       return $ INTERNAL_CHECK(checkSlice) "unstreamRMax" i (n-i) n
              $ unsafeSlice i (n-i) v