Expose unsafe mutable array APIs (#2375)
commite6975998bc3db6217155f698bf58d6e001913cd1
authorRanjeet Ranjan <ranjeetr@composewell.com>
dateTue 4 Jul 2023, 23:13 (3 years ago)
parent1ab2878
core/src/Streamly/Data/MutArray.hs+3
@@ -51,9 +51,12 @@ module Streamly.Data.MutArray
5151
5252 -- * Inplace mutation
5353 , putIndex
54+ , putIndexUnsafe
55+ , modifyIndexUnsafe
5456
5557 -- * Random access
5658 , getIndex
59+ , getIndexUnsafe
5760
5861 -- * Conversion
5962 , toList
core/src/Streamly/Internal/Data/Array/Mut/Type.hs+1−1
@@ -1647,7 +1647,7 @@ foldr f z arr = D.foldr f z $ toStreamD arr
16471647
16481648-- XXX Keep the bound intact to not lose any free space? Perf impact?
16491649
1650−-- | @writeAppendNUnsafe n alloc@ appends up to @n@ input items to the supplied
1650+-- | @writeAppendNUnsafe n arr@ appends up to @n@ input items to the supplied
16511651-- array.
16521652--
16531653-- Unsafe: Do not drive the fold beyond @n@ elements, it will lead to memory