@@ -2603,33 +2603,41 @@ breakOn sep arr@MutArray{..} = asUnpinnedPtrUnsafe arr $ \p -> liftIO $ do
2606+-- | Like 'splitAt' but does not check whether the index is valid.
2608+{-# INLINE unsafeSplitAt #-}
2609+unsafeSplitAt :: forall a. Unbox a =>
2610+ Int -> MutArray a -> (MutArray a, MutArray a)
2611+unsafeSplitAt i MutArray{..} =
2612+ let off = i * SIZE_OF(a)
2615+ { arrContents = arrContents
2616+ , arrStart = arrStart
2621+ { arrContents = arrContents
2624+ , arrBound = arrBound
2606-- | Create two slices of an array without copying the original array. The
2628-- | Create two slices of an array without copying the original array. The
2607-- specified index @i@ is the first index of the second slice.
2629-- specified index @i@ is the first index of the second slice.
2609{-# INLINE splitAt #-}
2631{-# INLINE splitAt #-}
2610splitAt :: forall a. Unbox a => Int -> MutArray a -> (MutArray a, MutArray a)
2632splitAt :: forall a. Unbox a => Int -> MutArray a -> (MutArray a, MutArray a)
2611−splitAt i arr@MutArray{..} =
2633+splitAt i arr =
2612 let maxIndex = length arr - 1
2634 let maxIndex = length arr - 1
2613 in if i < 0
2635 in if i < 0
2614 then error "sliceAt: negative array index"
2636 then error "sliceAt: negative array index"
2615 else if i > maxIndex
2637 else if i > maxIndex
2616 then error $ "sliceAt: specified array index " ++ show i
2638 then error $ "sliceAt: specified array index " ++ show i
2617 ++ " is beyond the maximum index " ++ show maxIndex
2639 ++ " is beyond the maximum index " ++ show maxIndex
2618− else let off = i * SIZE_OF(a)
2640+ else unsafeSplitAt i arr
2621− { arrContents = arrContents
2622− , arrStart = arrStart
2627− { arrContents = arrContents
2630− , arrBound = arrBound
2634-------------------------------------------------------------------------------
2642-------------------------------------------------------------------------------
2635-- Casting
2643-- Casting