@@ -1163,10 +1163,22 @@ getSlice index len (Array contents start e _) =
11631163-- to another array. However, in-place reverse can be useful to take adavantage
11641164-- of cache locality and when you do not want to allocate additional memory.
11651165--
1166−-- /Unimplemented/
1166+-- /Pre-release/
11671167{-# INLINE reverse #-}
1168−reverse :: Array a -> m Bool
1169−reverse = undefined
1168+reverse :: forall m a. (MonadIO m, Storable a) => Array a -> m ()
1169+reverse Array{..} = liftIO $ do
1170+ let l = arrStart
1171+ h = aEnd `plusPtr` (- elemSize)
1172+ in swap l h
1173+
1174+ where
1175+
1176+ elemSize = sizeOf (undefined :: a)
1177+
1178+ swap l h = do
1179+ when (l < h) $ do
1180+ swapPtrs l h
1181+ swap (l `plusPtr` elemSize) (h `plusPtr` (- elemSize))
11701182
11711183-- | Generate the next permutation of the sequence, returns False if this is
11721184-- the last permutation.