@@ -228,7 +228,7 @@ import Foreign.Ptr (plusPtr, minusPtr, nullPtr)
228228import Streamly.Internal.Control.Exception (assertM)
229229import Streamly.Internal.Data.Unboxed
230230 ( ArrayContents(..)
231− , Storable
231+ , Unboxed
232232 , alignment
233233 , castContents
234234 , getMutableByteArray#
@@ -289,11 +289,11 @@ foreign import ccall unsafe "string.h memchr" c_memchr
289289foreign import ccall unsafe "string.h memcmp" c_memcmp
290290 :: Ptr Word8 -> Ptr Word8 -> CSize -> IO CInt
291291
292−-- | Given a 'Storable' type (unused first arg) and a number of bytes, return
292+-- | Given an 'Unboxed' type (unused first arg) and a number of bytes, return
293293-- how many elements of that type will completely fit in those bytes.
294294--
295295{-# INLINE bytesToElemCount #-}
296−bytesToElemCount :: forall a. Storable a => a -> Int -> Int
296+bytesToElemCount :: forall a. Unboxed a => a -> Int -> Int
297297bytesToElemCount _ n = n `div` SIZE_OF(a)
298298
299299-- XXX we are converting Int to CSize
@@ -314,7 +314,7 @@ memcmp p1 p2 len = do
314314
315315-- $arrayNotes
316316--
317−-- We can use a 'Storable' constraint in the Array type and the constraint can
317+-- We can use an 'Unboxed' constraint in the Array type and the constraint can
318318-- be automatically provided to a function that pattern matches on the Array
319319-- type. However, it has huge performance cost, so we do not use it.
320320-- Investigate a GHC improvement possiblity.
@@ -340,7 +340,7 @@ memcmp p1 p2 len = do
340340--
341341data Array a =
342342#ifdef DEVBUILD
343− Storable a =>
343+ Unboxed a =>
344344#endif
345345 -- The array is a range into arrContents. arrContents may be a superset of
346346 -- the slice represented by the array. All offsets are in bytes.
@@ -394,7 +394,7 @@ unpin arr@(Array{..}) = do
394394--
395395-- /Pre-release/
396396{-# INLINE newArrayWith #-}
397−newArrayWith :: forall m a. (MonadIO m, Storable a)
397+newArrayWith :: forall m a. (MonadIO m, Unboxed a)
398398 => (Int -> Int -> m (ArrayContents a)) -> Int -> Int -> m (Array a)
399399newArrayWith alloc alignSize count = do
400400 let size = max (count * SIZE_OF(a)) 0
@@ -425,17 +425,17 @@ nilArrayContents =
425425
426426nil ::
427427#ifdef DEVBUILD
428− Storable a =>
428+ Unboxed a =>
429429#endif
430430 Array a
431431nil = Array nilArrayContents 0 0 0
432432
433433-- | Like 'newArrayWith' but using an allocator that aligns the memory to the
434−-- alignment dictated by the 'Storable' instance of the type.
434+-- alignment dictated by the 'Unboxed' instance of the type.
435435--
436436-- /Internal/
437437{-# INLINE newArrayAligned #-}
438−newArrayAligned :: (MonadIO m, Storable a) => Int -> Int -> m (Array a)
438+newArrayAligned :: (MonadIO m, Unboxed a) => Int -> Int -> m (Array a)
439439newArrayAligned = newArrayWith (\s a -> liftIO $ newAlignedArrayContents s a)
440440
441441-- XXX Intead of newArray, make newPinnedArray and newUnpinnedArray. Make it
@@ -443,21 +443,21 @@ newArrayAligned = newArrayWith (\s a -> liftIO $ newAlignedArrayContents s a)
443443-- XXX can unaligned allocation be more efficient when alignment is not needed?
444444--
445445-- | Allocates an empty array that can hold 'count' items. The memory of the
446−-- array is uninitialized and the allocation is aligned as per the 'Storable'
446+-- array is uninitialized and the allocation is aligned as per the 'Unboxed'
447447-- instance of the type.
448448--
449449-- /Pre-release/
450450{-# INLINE newArray #-}
451−newArray :: forall m a. (MonadIO m, Storable a) => Int -> m (Array a)
451+newArray :: forall m a. (MonadIO m, Unboxed a) => Int -> m (Array a)
452452newArray = newArrayAligned (alignment (undefined :: a))
453453
454454-- | Allocates a pinned empty array that can hold 'count' items. The memory of
455455-- the array is uninitialized and the allocation is aligned as per the
456−-- 'Storable' instance of the type.
456+-- 'Unboxed' instance of the type.
457457--
458458-- /Pre-release/
459459{-# INLINE newPinnedArrayBytes #-}
460−newPinnedArrayBytes :: forall m a. (MonadIO m, Storable a) => Int -> m (Array a)
460+newPinnedArrayBytes :: forall m a. (MonadIO m, Unboxed a) => Int -> m (Array a)
461461newPinnedArrayBytes bytes = do
462462 contents <-
463463 liftIO $ newAlignedArrayContents bytes (alignment (undefined :: a))
@@ -474,7 +474,7 @@ newPinnedArrayBytes bytes = do
474474-- /Internal/
475475{-# INLINE withNewArrayUnsafe #-}
476476withNewArrayUnsafe ::
477− (MonadIO m, Storable a) => Int -> (Ptr a -> m ()) -> m (Array a)
477+ (MonadIO m, Unboxed a) => Int -> (Ptr a -> m ()) -> m (Array a)
478478withNewArrayUnsafe count f = do
479479 arr <- newArray count
480480 asPtrUnsafe arr
@@ -489,7 +489,7 @@ withNewArrayUnsafe count f = do
489489--
490490-- /Pre-release/
491491{-# INLINE putIndexUnsafe #-}
492−putIndexUnsafe :: forall m a. (MonadIO m, Storable a)
492+putIndexUnsafe :: forall m a. (MonadIO m, Unboxed a)
493493 => Int -> a -> Array a -> m ()
494494putIndexUnsafe i x (Array {..}) = do
495495 let index = INDEX_OF(arrStart, i, a)
@@ -509,7 +509,7 @@ invalidIndex label i =
509509--
510510-- /Pre-release/
511511{-# INLINE putIndex #-}
512−putIndex :: forall m a. (MonadIO m, Storable a) => Int -> a -> Array a -> m ()
512+putIndex :: forall m a. (MonadIO m, Unboxed a) => Int -> a -> Array a -> m ()
513513putIndex i x Array{..} = do
514514 let index = INDEX_OF(arrStart,i,a)
515515 if i >= 0 && INDEX_VALID(index,aEnd,a)
@@ -521,7 +521,7 @@ putIndex i x Array{..} = do
521521--
522522-- /Pre-release/
523523{-# INLINE putIndices #-}
524−putIndices :: forall m a. (MonadIO m, Storable a)
524+putIndices :: forall m a. (MonadIO m, Unboxed a)
525525 => Array a -> Fold m (Int, a) ()
526526putIndices arr = FL.foldlM' step (return ())
527527
@@ -532,7 +532,7 @@ putIndices arr = FL.foldlM' step (return ())
532532-- | Modify a given index of an array using a modifier function.
533533--
534534-- /Pre-release/
535−modifyIndexUnsafe :: forall m a b. (MonadIO m, Storable a) =>
535+modifyIndexUnsafe :: forall m a b. (MonadIO m, Unboxed a) =>
536536 Int -> (a -> (a, b)) -> Array a -> m b
537537modifyIndexUnsafe i f (Array{..}) = liftIO $ do
538538 let index = INDEX_OF(arrStart,i,a)
@@ -545,7 +545,7 @@ modifyIndexUnsafe i f (Array{..}) = liftIO $ do
545545-- | Modify a given index of an array using a modifier function.
546546--
547547-- /Pre-release/
548−modifyIndex :: forall m a b. (MonadIO m, Storable a) =>
548+modifyIndex :: forall m a b. (MonadIO m, Unboxed a) =>
549549 Int -> (a -> (a, b)) -> Array a -> m b
550550modifyIndex i f Array{..} = do
551551 let index = INDEX_OF(arrStart,i,a)
@@ -562,7 +562,7 @@ modifyIndex i f Array{..} = do
562562--
563563-- /Pre-release/
564564{-# INLINE modifyIndices #-}
565−modifyIndices :: forall m a . (MonadIO m, Storable a)
565+modifyIndices :: forall m a . (MonadIO m, Unboxed a)
566566 => (Int -> a -> a) -> Array a -> Fold m Int ()
567567modifyIndices f arr = FL.foldlM' step initial
568568
@@ -577,7 +577,7 @@ modifyIndices f arr = FL.foldlM' step initial
577577-- | Modify each element of an array using the supplied modifier function.
578578--
579579-- /Pre-release/
580−modify :: forall m a. (MonadIO m, Storable a)
580+modify :: forall m a. (MonadIO m, Unboxed a)
581581 => (a -> a) -> Array a -> m ()
582582modify f Array{..} = liftIO $
583583 go arrStart
@@ -591,7 +591,7 @@ modify f Array{..} = liftIO $
591591 go (INDEX_NEXT(i,a))
592592
593593{-# INLINE swapArrayByteIndices #-}
594−swapArrayByteIndices :: Storable a => ArrayContents a -> Int -> Int -> IO ()
594+swapArrayByteIndices :: Unboxed a => ArrayContents a -> Int -> Int -> IO ()
595595swapArrayByteIndices arrContents i1 i2 = do
596596 r1 <- peekWith arrContents i1
597597 r2 <- peekWith arrContents i2
@@ -604,7 +604,7 @@ swapArrayByteIndices arrContents i1 i2 = do
604604--
605605-- /Pre-release/
606606{-# INLINE unsafeSwapIndices #-}
607−unsafeSwapIndices :: forall m a. (MonadIO m, Storable a)
607+unsafeSwapIndices :: forall m a. (MonadIO m, Unboxed a)
608608 => Int -> Int -> Array a -> m ()
609609unsafeSwapIndices i1 i2 Array{..} = liftIO $ do
610610 let t1 = INDEX_OF(arrStart,i1,a)
@@ -614,7 +614,7 @@ unsafeSwapIndices i1 i2 Array{..} = liftIO $ do
614614-- | Swap the elements at two indices.
615615--
616616-- /Pre-release/
617−swapIndices :: forall m a. (MonadIO m, Storable a)
617+swapIndices :: forall m a. (MonadIO m, Unboxed a)
618618 => Int -> Int -> Array a -> m ()
619619swapIndices i1 i2 Array{..} = liftIO $ do
620620 let t1 = INDEX_OF(arrStart,i1,a)
@@ -685,15 +685,15 @@ roundUpToPower2 n =
685685-- case it returns one element's size.
686686--
687687{-# INLINE allocBytesToBytes #-}
688−allocBytesToBytes :: forall a. Storable a => a -> Int -> Int
688+allocBytesToBytes :: forall a. Unboxed a => a -> Int -> Int
689689allocBytesToBytes _ n = max (arrayPayloadSize n) (SIZE_OF(a))
690690
691−-- | Given a 'Storable' type (unused first arg) and real allocation size
691+-- | Given an 'Unboxed' type (unused first arg) and real allocation size
692692-- (including overhead), return how many elements of that type will completely
693693-- fit in it, returns at least 1.
694694--
695695{-# INLINE allocBytesToElemCount #-}
696−allocBytesToElemCount :: Storable a => a -> Int -> Int
696+allocBytesToElemCount :: Unboxed a => a -> Int -> Int
697697allocBytesToElemCount x bytes =
698698 let n = bytesToElemCount x (allocBytesToBytes x bytes)
699699 in assert (n >= 1) n
@@ -715,8 +715,8 @@ roundDownTo elemSize size = size - (size `mod` elemSize)
715715-- XXX See if resizing can be implemented by reading the old array as a stream
716716-- and then using writeN to the new array.
717717--
718−-- NOTE: we are passing elemSize explicitly to avoid a Storable constraint.
719−-- Since this is not inlined Storable consrraint leads to dictionary passing
718+-- NOTE: we are passing elemSize explicitly to avoid an Unboxed constraint.
719+-- Since this is not inlined Unboxed consrraint leads to dictionary passing
720720-- which complicates some inspection tests.
721721--
722722{-# NOINLINE reallocAligned #-}
@@ -758,14 +758,14 @@ reallocAligned elemSize alignSize newCapacityInBytes Array{..} = do
758758-- 'largeObjectThreshold' then it is rounded up to the block size (4K).
759759--
760760{-# INLINABLE realloc #-}
761−realloc :: forall m a. (MonadIO m, Storable a) => Int -> Array a -> m (Array a)
761+realloc :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m (Array a)
762762realloc bytes arr =
763763 liftIO $ reallocAligned (SIZE_OF(a)) (alignment (undefined :: a)) bytes arr
764764
765765-- | @reallocWith label capSizer minIncrBytes array@. The label is used
766766-- in error messages and the capSizer is used to determine the capacity of the
767767-- new array in bytes given the current byte length of the array.
768−reallocWith :: forall m a. (MonadIO m , Storable a) =>
768+reallocWith :: forall m a. (MonadIO m , Unboxed a) =>
769769 String
770770 -> (Int -> Int)
771771 -> Int
@@ -799,7 +799,7 @@ reallocWith label capSizer minIncrBytes arr = do
799799--
800800-- /Pre-release/
801801{-# INLINE resize #-}
802−resize :: forall m a. (MonadIO m, Storable a) =>
802+resize :: forall m a. (MonadIO m, Unboxed a) =>
803803 Int -> Array a -> m (Array a)
804804resize nElems arr@Array{..} = do
805805 let req = SIZE_OF(a) * nElems
@@ -813,7 +813,7 @@ resize nElems arr@Array{..} = do
813813--
814814-- /Pre-release/
815815{-# INLINE resizeExp #-}
816−resizeExp :: forall m a. (MonadIO m, Storable a) =>
816+resizeExp :: forall m a. (MonadIO m, Unboxed a) =>
817817 Int -> Array a -> m (Array a)
818818resizeExp nElems arr@Array{..} = do
819819 let req = roundUpLargeArray (SIZE_OF(a) * nElems)
@@ -835,7 +835,7 @@ resizeExp nElems arr@Array{..} = do
835835--
836836-- /Pre-release/
837837{-# INLINE rightSize #-}
838−rightSize :: forall m a. (MonadIO m, Storable a) => Array a -> m (Array a)
838+rightSize :: forall m a. (MonadIO m, Unboxed a) => Array a -> m (Array a)
839839rightSize arr@Array{..} = do
840840 assert (aEnd <= aBound) (return ())
841841 let start = arrStart
@@ -867,7 +867,7 @@ rightSize arr@Array{..} = do
867867--
868868-- /Internal/
869869{-# INLINE snocNewEnd #-}
870−snocNewEnd :: (MonadIO m, Storable a) => Int -> Array a -> a -> m (Array a)
870+snocNewEnd :: (MonadIO m, Unboxed a) => Int -> Array a -> a -> m (Array a)
871871snocNewEnd newEnd arr@Array{..} x = liftIO $ do
872872 assert (newEnd <= aBound) (return ())
873873 pokeWith arrContents aEnd x
@@ -879,7 +879,7 @@ snocNewEnd newEnd arr@Array{..} x = liftIO $ do
879879--
880880-- /Internal/
881881{-# INLINE snocUnsafe #-}
882−snocUnsafe :: forall m a. (MonadIO m, Storable a) =>
882+snocUnsafe :: forall m a. (MonadIO m, Unboxed a) =>
883883 Array a -> a -> m (Array a)
884884snocUnsafe arr@Array{..} = snocNewEnd (INDEX_NEXT(aEnd,a)) arr
885885
@@ -888,7 +888,7 @@ snocUnsafe arr@Array{..} = snocNewEnd (INDEX_NEXT(aEnd,a)) arr
888888--
889889-- /Internal/
890890{-# INLINE snocMay #-}
891−snocMay :: forall m a. (MonadIO m, Storable a) =>
891+snocMay :: forall m a. (MonadIO m, Unboxed a) =>
892892 Array a -> a -> m (Maybe (Array a))
893893snocMay arr@Array{..} x = liftIO $ do
894894 let newEnd = INDEX_NEXT(aEnd,a)
@@ -898,7 +898,7 @@ snocMay arr@Array{..} x = liftIO $ do
898898
899899-- NOINLINE to move it out of the way and not pollute the instruction cache.
900900{-# NOINLINE snocWithRealloc #-}
901−snocWithRealloc :: forall m a. (MonadIO m, Storable a) =>
901+snocWithRealloc :: forall m a. (MonadIO m, Unboxed a) =>
902902 (Int -> Int)
903903 -> Array a
904904 -> a
@@ -921,7 +921,7 @@ snocWithRealloc sizer arr x = do
921921--
922922-- /Pre-release/
923923{-# INLINE snocWith #-}
924−snocWith :: forall m a. (MonadIO m, Storable a) =>
924+snocWith :: forall m a. (MonadIO m, Unboxed a) =>
925925 (Int -> Int)
926926 -> Array a
927927 -> a
@@ -943,7 +943,7 @@ snocWith allocSize arr x = liftIO $ do
943943--
944944-- /Pre-release/
945945{-# INLINE snocLinear #-}
946−snocLinear :: forall m a. (MonadIO m, Storable a) => Array a -> a -> m (Array a)
946+snocLinear :: forall m a. (MonadIO m, Unboxed a) => Array a -> a -> m (Array a)
947947snocLinear = snocWith (+ allocBytesToBytes (undefined :: a) arrayChunkBytes)
948948
949949-- | The array is mutated to append an additional element to it. If there is no
@@ -961,7 +961,7 @@ snocLinear = snocWith (+ allocBytesToBytes (undefined :: a) arrayChunkBytes)
961961--
962962-- /Pre-release/
963963{-# INLINE snoc #-}
964−snoc :: forall m a. (MonadIO m, Storable a) => Array a -> a -> m (Array a)
964+snoc :: forall m a. (MonadIO m, Unboxed a) => Array a -> a -> m (Array a)
965965snoc = snocWith f
966966
967967 where
@@ -981,7 +981,7 @@ snoc = snocWith f
981981--
982982-- Unsafe because it does not check the bounds of the array.
983983{-# INLINE_NORMAL getIndexUnsafe #-}
984−getIndexUnsafe :: forall m a. (MonadIO m, Storable a) => Int -> Array a -> m a
984+getIndexUnsafe :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
985985getIndexUnsafe i (Array {..}) = do
986986 let index = INDEX_OF(arrStart,i,a)
987987 assert (i >= 0 && INDEX_VALID(index,aEnd,a)) (return ())
@@ -990,7 +990,7 @@ getIndexUnsafe i (Array {..}) = do
990990-- | /O(1)/ Lookup the element at the given index. Index starts from 0.
991991--
992992{-# INLINE getIndex #-}
993−getIndex :: forall m a. (MonadIO m, Storable a) => Int -> Array a -> m a
993+getIndex :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
994994getIndex i Array{..} = do
995995 let index = INDEX_OF(arrStart,i,a)
996996 if i >= 0 && INDEX_VALID(index,aEnd,a)
@@ -1003,7 +1003,7 @@ getIndex i Array{..} = do
10031003-- Slightly faster than computing the forward index and using getIndex.
10041004--
10051005{-# INLINE getIndexRev #-}
1006−getIndexRev :: forall m a. (MonadIO m, Storable a) => Int -> Array a -> m a
1006+getIndexRev :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
10071007getIndexRev i Array{..} = do
10081008 let index = RINDEX_OF(aEnd,i,a)
10091009 if i >= 0 && index >= arrStart
@@ -1019,7 +1019,7 @@ data GetIndicesState contents start end st =
10191019--
10201020-- /Pre-release/
10211021{-# INLINE getIndicesD #-}
1022−getIndicesD :: (Monad m, Storable a) =>
1022+getIndicesD :: (Monad m, Unboxed a) =>
10231023 (forall b. IO b -> m b) -> D.Stream m Int -> Unfold m (Array a) a
10241024getIndicesD liftio (D.Stream stepi sti) = Unfold step inject
10251025
@@ -1039,7 +1039,7 @@ getIndicesD liftio (D.Stream stepi sti) = Unfold step inject
10391039 D.Stop -> return D.Stop
10401040
10411041{-# INLINE getIndices #-}
1042−getIndices :: (MonadIO m, Storable a) => Stream m Int -> Unfold m (Array a) a
1042+getIndices :: (MonadIO m, Unboxed a) => Stream m Int -> Unfold m (Array a) a
10431043getIndices = getIndicesD liftIO . Stream.toStreamD
10441044
10451045-------------------------------------------------------------------------------
@@ -1056,7 +1056,7 @@ getIndices = getIndicesD liftIO . Stream.toStreamD
10561056--
10571057-- /Pre-release/
10581058{-# INLINE getSliceUnsafe #-}
1059−getSliceUnsafe :: forall a. Storable a
1059+getSliceUnsafe :: forall a. Unboxed a
10601060 => Int -- ^ from index
10611061 -> Int -- ^ length of the slice
10621062 -> Array a
@@ -1075,7 +1075,7 @@ getSliceUnsafe index len (Array contents start e _) =
10751075--
10761076-- /Pre-release/
10771077{-# INLINE getSlice #-}
1078−getSlice :: forall a. Storable a =>
1078+getSlice :: forall a. Unboxed a =>
10791079 Int -- ^ from index
10801080 -> Int -- ^ length of the slice
10811081 -> Array a
@@ -1104,7 +1104,7 @@ getSlice index len (Array contents start e _) =
11041104--
11051105-- /Pre-release/
11061106{-# INLINE reverse #-}
1107−reverse :: forall m a. (MonadIO m, Storable a) => Array a -> m ()
1107+reverse :: forall m a. (MonadIO m, Unboxed a) => Array a -> m ()
11081108reverse Array{..} = liftIO $ do
11091109 let l = arrStart
11101110 h = INDEX_PREV(aEnd,a)
@@ -1131,7 +1131,7 @@ permute = undefined
11311131--
11321132-- /Pre-release/
11331133{-# INLINE partitionBy #-}
1134−partitionBy :: forall m a. (MonadIO m, Storable a)
1134+partitionBy :: forall m a. (MonadIO m, Unboxed a)
11351135 => (a -> Bool) -> Array a -> m (Array a, Array a)
11361136partitionBy f arr@Array{..} = liftIO $ do
11371137 if arrStart >= aEnd
@@ -1255,7 +1255,7 @@ byteLength Array{..} =
12551255--
12561256-- @since 0.7.0
12571257{-# INLINE length #-}
1258−length :: forall a. Storable a => Array a -> Int
1258+length :: forall a. Unboxed a => Array a -> Int
12591259length arr =
12601260 let elemSize = SIZE_OF(a)
12611261 blen = byteLength arr
@@ -1299,7 +1299,7 @@ data GroupState s contents start end bound
12991299--
13001300-- /Pre-release/
13011301{-# INLINE_NORMAL arraysOf #-}
1302−arraysOf :: forall m a. (MonadIO m, Storable a)
1302+arraysOf :: forall m a. (MonadIO m, Unboxed a)
13031303 => Int -> D.Stream m a -> D.Stream m (Array a)
13041304-- XXX the idiomatic implementation leads to large regression in the D.reverse'
13051305-- benchmark. It seems it has difficulty producing optimized code when
@@ -1346,7 +1346,7 @@ arraysOf n (D.Stream step state) =
13461346-- XXX buffer to a list instead?
13471347-- | Buffer the stream into arrays in memory.
13481348{-# INLINE arrayStreamKFromStreamD #-}
1349−arrayStreamKFromStreamD :: forall m a. (MonadIO m, Storable a) =>
1349+arrayStreamKFromStreamD :: forall m a. (MonadIO m, Unboxed a) =>
13501350 D.Stream m a -> m (K.Stream m (Array a))
13511351arrayStreamKFromStreamD =
13521352 let n = allocBytesToElemCount (undefined :: a) defaultChunkSize
@@ -1367,7 +1367,7 @@ data FlattenState s contents a =
13671367-- We can try this if there are any fusion issues in the unfold.
13681368--
13691369{-# INLINE_NORMAL flattenArrays #-}
1370−flattenArrays :: forall m a. (MonadIO m, Storable a)
1370+flattenArrays :: forall m a. (MonadIO m, Unboxed a)
13711371 => D.Stream m (Array a) -> D.Stream m a
13721372flattenArrays (D.Stream step state) = D.Stream step' (OuterLoop state)
13731373
@@ -1396,7 +1396,7 @@ flattenArrays (D.Stream step state) = D.Stream step' (OuterLoop state)
13961396-- We can try this if there are any fusion issues in the unfold.
13971397--
13981398{-# INLINE_NORMAL flattenArraysRev #-}
1399−flattenArraysRev :: forall m a. (MonadIO m, Storable a)
1399+flattenArraysRev :: forall m a. (MonadIO m, Unboxed a)
14001400 => D.Stream m (Array a) -> D.Stream m a
14011401flattenArraysRev (D.Stream step state) = D.Stream step' (OuterLoop state)
14021402
@@ -1436,7 +1436,7 @@ toArrayUnsafe (Array contents start end _) = ArrayUnsafe contents start end
14361436
14371437fromArrayUnsafe ::
14381438#ifdef DEVBUILD
1439− Storable a =>
1439+ Unboxed a =>
14401440#endif
14411441 ArrayUnsafe a -> Array a
14421442fromArrayUnsafe (ArrayUnsafe contents start end) =
@@ -1444,7 +1444,7 @@ fromArrayUnsafe (ArrayUnsafe contents start end) =
14441444
14451445{-# INLINE_NORMAL producerWith #-}
14461446producerWith ::
1447− forall m a. (Monad m, Storable a)
1447+ forall m a. (Monad m, Unboxed a)
14481448 => (forall b. IO b -> m b) -> Producer m (Array a) a
14491449producerWith liftio = Producer step (return . toArrayUnsafe) extract
14501450 where
@@ -1465,19 +1465,19 @@ producerWith liftio = Producer step (return . toArrayUnsafe) extract
14651465-- | Resumable unfold of an array.
14661466--
14671467{-# INLINE_NORMAL producer #-}
1468−producer :: forall m a. (MonadIO m, Storable a) => Producer m (Array a) a
1468+producer :: forall m a. (MonadIO m, Unboxed a) => Producer m (Array a) a
14691469producer = producerWith liftIO
14701470
14711471-- | Unfold an array into a stream.
14721472--
14731473-- @since 0.7.0
14741474{-# INLINE_NORMAL read #-}
1475−read :: forall m a. (MonadIO m, Storable a) => Unfold m (Array a) a
1475+read :: forall m a. (MonadIO m, Unboxed a) => Unfold m (Array a) a
14761476read = Producer.simplify producer
14771477
14781478{-# INLINE_NORMAL readRevWith #-}
14791479readRevWith ::
1480− forall m a. (Monad m, Storable a)
1480+ forall m a. (Monad m, Unboxed a)
14811481 => (forall b. IO b -> m b) -> Unfold m (Array a) a
14821482readRevWith liftio = Unfold step inject
14831483 where
@@ -1496,7 +1496,7 @@ readRevWith liftio = Unfold step inject
14961496--
14971497-- /Pre-release/
14981498{-# INLINE_NORMAL readRev #-}
1499−readRev :: forall m a. (MonadIO m, Storable a) => Unfold m (Array a) a
1499+readRev :: forall m a. (MonadIO m, Unboxed a) => Unfold m (Array a) a
15001500readRev = readRevWith liftIO
15011501
15021502-------------------------------------------------------------------------------
@@ -1507,7 +1507,7 @@ readRev = readRevWith liftIO
15071507-- Use foldr/build fusion to fuse with list consumers
15081508-- This can be useful when using the IsList instance
15091509{-# INLINE_LATE toListFB #-}
1510−toListFB :: forall a b. Storable a => (a -> b -> b) -> b -> Array a -> b
1510+toListFB :: forall a b. Unboxed a => (a -> b -> b) -> b -> Array a -> b
15111511toListFB c n Array{..} = go arrStart
15121512 where
15131513
@@ -1532,7 +1532,7 @@ toListFB c n Array{..} = go arrStart
15321532--
15331533-- @since 0.7.0
15341534{-# INLINE toList #-}
1535−toList :: forall m a. (MonadIO m, Storable a) => Array a -> m [a]
1535+toList :: forall m a. (MonadIO m, Unboxed a) => Array a -> m [a]
15361536toList Array{..} = liftIO $ go arrStart
15371537 where
15381538
@@ -1543,7 +1543,7 @@ toList Array{..} = liftIO $ go arrStart
15431543
15441544{-# INLINE_NORMAL toStreamDWith #-}
15451545toStreamDWith ::
1546− forall m a. (Monad m, Storable a)
1546+ forall m a. (Monad m, Unboxed a)
15471547 => (forall b. IO b -> m b) -> Array a -> D.Stream m a
15481548toStreamDWith liftio Array{..} = D.Stream step arrStart
15491549
@@ -1561,12 +1561,12 @@ toStreamDWith liftio Array{..} = D.Stream step arrStart
15611561--
15621562-- We can try this if the unfold has any performance issues.
15631563{-# INLINE_NORMAL toStreamD #-}
1564−toStreamD :: forall m a. (MonadIO m, Storable a) => Array a -> D.Stream m a
1564+toStreamD :: forall m a. (MonadIO m, Unboxed a) => Array a -> D.Stream m a
15651565toStreamD = toStreamDWith liftIO
15661566
15671567{-# INLINE toStreamKWith #-}
15681568toStreamKWith ::
1569− forall m a. (Monad m, Storable a)
1569+ forall m a. (Monad m, Unboxed a)
15701570 => (forall b. IO b -> m b) -> Array a -> K.Stream m a
15711571toStreamKWith liftio Array{..} = go arrStart
15721572
@@ -1580,12 +1580,12 @@ toStreamKWith liftio Array{..} = go arrStart
15801580 in liftio elemM `K.consM` go (INDEX_NEXT(p,a))
15811581
15821582{-# INLINE toStreamK #-}
1583−toStreamK :: forall m a. (MonadIO m, Storable a) => Array a -> K.Stream m a
1583+toStreamK :: forall m a. (MonadIO m, Unboxed a) => Array a -> K.Stream m a
15841584toStreamK = toStreamKWith liftIO
15851585
15861586{-# INLINE_NORMAL toStreamDRevWith #-}
15871587toStreamDRevWith ::
1588− forall m a. (Monad m, Storable a)
1588+ forall m a. (Monad m, Unboxed a)
15891589 => (forall b. IO b -> m b) -> Array a -> D.Stream m a
15901590toStreamDRevWith liftio Array{..} =
15911591 let p = INDEX_PREV(aEnd,a)
@@ -1605,12 +1605,12 @@ toStreamDRevWith liftio Array{..} =
16051605--
16061606-- We can try this if the unfold has any perf issues.
16071607{-# INLINE_NORMAL toStreamDRev #-}
1608−toStreamDRev :: forall m a. (MonadIO m, Storable a) => Array a -> D.Stream m a
1608+toStreamDRev :: forall m a. (MonadIO m, Unboxed a) => Array a -> D.Stream m a
16091609toStreamDRev = toStreamDRevWith liftIO
16101610
16111611{-# INLINE toStreamKRevWith #-}
16121612toStreamKRevWith ::
1613− forall m a. (Monad m, Storable a)
1613+ forall m a. (Monad m, Unboxed a)
16141614 => (forall b. IO b -> m b) -> Array a -> K.Stream m a
16151615toStreamKRevWith liftio Array {..} =
16161616 let p = INDEX_PREV(aEnd,a)
@@ -1626,7 +1626,7 @@ toStreamKRevWith liftio Array {..} =
16261626 in liftio elemM `K.consM` go (INDEX_PREV(p,a))
16271627
16281628{-# INLINE toStreamKRev #-}
1629−toStreamKRev :: forall m a. (MonadIO m, Storable a) => Array a -> K.Stream m a
1629+toStreamKRev :: forall m a. (MonadIO m, Unboxed a) => Array a -> K.Stream m a
16301630toStreamKRev = toStreamKRevWith liftIO
16311631
16321632-------------------------------------------------------------------------------
@@ -1638,12 +1638,12 @@ toStreamKRev = toStreamKRevWith liftIO
16381638--
16391639-- | Strict left fold of an array.
16401640{-# INLINE_NORMAL foldl' #-}
1641−foldl' :: (MonadIO m, Storable a) => (b -> a -> b) -> b -> Array a -> m b
1641+foldl' :: (MonadIO m, Unboxed a) => (b -> a -> b) -> b -> Array a -> m b
16421642foldl' f z arr = D.foldl' f z $ toStreamD arr
16431643
16441644-- | Right fold of an array.
16451645{-# INLINE_NORMAL foldr #-}
1646−foldr :: (MonadIO m, Storable a) => (a -> b -> b) -> b -> Array a -> m b
1646+foldr :: (MonadIO m, Unboxed a) => (a -> b -> b) -> b -> Array a -> m b
16471647foldr f z arr = D.foldr f z $ toStreamD arr
16481648
16491649-------------------------------------------------------------------------------
@@ -1667,7 +1667,7 @@ foldr f z arr = D.foldr f z $ toStreamD arr
16671667--
16681668-- /Internal/
16691669{-# INLINE_NORMAL appendNUnsafe #-}
1670−appendNUnsafe :: forall m a. (MonadIO m, Storable a) =>
1670+appendNUnsafe :: forall m a. (MonadIO m, Unboxed a) =>
16711671 m (Array a)
16721672 -> Int
16731673 -> Fold m a (Array a)
@@ -1700,7 +1700,7 @@ appendNUnsafe action n =
17001700--
17011701-- /Pre-release/
17021702{-# INLINE_NORMAL appendN #-}
1703−appendN :: forall m a. (MonadIO m, Storable a) =>
1703+appendN :: forall m a. (MonadIO m, Unboxed a) =>
17041704 m (Array a) -> Int -> Fold m a (Array a)
17051705appendN initial n = FL.take n (appendNUnsafe initial n)
17061706
@@ -1715,7 +1715,7 @@ appendN initial n = FL.take n (appendNUnsafe initial n)
17151715--
17161716-- /Pre-release/
17171717{-# INLINE appendWith #-}
1718−appendWith :: forall m a. (MonadIO m, Storable a) =>
1718+appendWith :: forall m a. (MonadIO m, Unboxed a) =>
17191719 (Int -> Int) -> m (Array a) -> Fold m a (Array a)
17201720appendWith sizer = FL.foldlM' (snocWith sizer)
17211721
@@ -1729,7 +1729,7 @@ appendWith sizer = FL.foldlM' (snocWith sizer)
17291729--
17301730-- /Pre-release/
17311731{-# INLINE append #-}
1732−append :: forall m a. (MonadIO m, Storable a) =>
1732+append :: forall m a. (MonadIO m, Unboxed a) =>
17331733 m (Array a) -> Fold m a (Array a)
17341734append = appendWith (* 2)
17351735
@@ -1743,7 +1743,7 @@ append = appendWith (* 2)
17431743--
17441744-- /Pre-release/
17451745{-# INLINE_NORMAL writeNWithUnsafe #-}
1746−writeNWithUnsafe :: forall m a. (MonadIO m, Storable a)
1746+writeNWithUnsafe :: forall m a. (MonadIO m, Unboxed a)
17471747 => (Int -> m (Array a)) -> Int -> Fold m a (Array a)
17481748writeNWithUnsafe alloc n = fromArrayUnsafe <$> FL.foldlM' step initial
17491749
@@ -1766,7 +1766,7 @@ writeNWithUnsafe alloc n = fromArrayUnsafe <$> FL.foldlM' step initial
17661766--
17671767-- @since 0.7.0
17681768{-# INLINE_NORMAL writeNUnsafe #-}
1769−writeNUnsafe :: forall m a. (MonadIO m, Storable a)
1769+writeNUnsafe :: forall m a. (MonadIO m, Unboxed a)
17701770 => Int -> Fold m a (Array a)
17711771writeNUnsafe = writeNWithUnsafe newArray
17721772
@@ -1777,7 +1777,7 @@ writeNUnsafe = writeNWithUnsafe newArray
17771777-- >>> writeNWith alloc n = Array.appendN (alloc n) n
17781778--
17791779{-# INLINE_NORMAL writeNWith #-}
1780−writeNWith :: forall m a. (MonadIO m, Storable a)
1780+writeNWith :: forall m a. (MonadIO m, Unboxed a)
17811781 => (Int -> m (Array a)) -> Int -> Fold m a (Array a)
17821782writeNWith alloc n = FL.take n (writeNWithUnsafe alloc n)
17831783
@@ -1790,14 +1790,14 @@ writeNWith alloc n = FL.take n (writeNWithUnsafe alloc n)
17901790--
17911791-- @since 0.7.0
17921792{-# INLINE_NORMAL writeN #-}
1793−writeN :: forall m a. (MonadIO m, Storable a) => Int -> Fold m a (Array a)
1793+writeN :: forall m a. (MonadIO m, Unboxed a) => Int -> Fold m a (Array a)
17941794writeN = writeNWith newArray
17951795
17961796-- | Like writeNWithUnsafe but writes the array in reverse order.
17971797--
17981798-- /Internal/
17991799{-# INLINE_NORMAL writeRevNWithUnsafe #-}
1800−writeRevNWithUnsafe :: forall m a. (MonadIO m, Storable a)
1800+writeRevNWithUnsafe :: forall m a. (MonadIO m, Unboxed a)
18011801 => (Int -> m (Array a)) -> Int -> Fold m a (Array a)
18021802writeRevNWithUnsafe alloc n = fromArrayUnsafe <$> FL.foldlM' step initial
18031803
@@ -1818,7 +1818,7 @@ writeRevNWithUnsafe alloc n = fromArrayUnsafe <$> FL.foldlM' step initial
18181818--
18191819-- /Internal/
18201820{-# INLINE_NORMAL writeRevNWith #-}
1821−writeRevNWith :: forall m a. (MonadIO m, Storable a)
1821+writeRevNWith :: forall m a. (MonadIO m, Unboxed a)
18221822 => (Int -> m (Array a)) -> Int -> Fold m a (Array a)
18231823writeRevNWith alloc n = FL.take n (writeRevNWithUnsafe alloc n)
18241824
@@ -1826,7 +1826,7 @@ writeRevNWith alloc n = FL.take n (writeRevNWithUnsafe alloc n)
18261826--
18271827-- /Pre-release/
18281828{-# INLINE_NORMAL writeRevN #-}
1829−writeRevN :: forall m a. (MonadIO m, Storable a) => Int -> Fold m a (Array a)
1829+writeRevN :: forall m a. (MonadIO m, Unboxed a) => Int -> Fold m a (Array a)
18301830writeRevN = writeRevNWith newArray
18311831
18321832-- | @writeNAligned align n@ folds a maximum of @n@ elements from the input
@@ -1838,7 +1838,7 @@ writeRevN = writeRevNWith newArray
18381838-- /Pre-release/
18391839--
18401840{-# INLINE_NORMAL writeNAligned #-}
1841−writeNAligned :: forall m a. (MonadIO m, Storable a)
1841+writeNAligned :: forall m a. (MonadIO m, Unboxed a)
18421842 => Int -> Int -> Fold m a (Array a)
18431843writeNAligned align = writeNWith (newArrayAligned align)
18441844
@@ -1856,7 +1856,7 @@ writeNAligned align = writeNWith (newArrayAligned align)
18561856-- /Unimplemented/
18571857--
18581858{-# INLINE_NORMAL writeChunks #-}
1859−writeChunks :: (MonadIO m, Storable a) =>
1859+writeChunks :: (MonadIO m, Unboxed a) =>
18601860 Int -> Fold m a (K.Stream n (Array a))
18611861writeChunks n = FL.many (writeN n) FL.toStreamK
18621862
@@ -1889,7 +1889,7 @@ writeChunks n = FL.many (writeN n) FL.toStreamK
18891889--
18901890-- /Pre-release/
18911891{-# INLINE_NORMAL writeWith #-}
1892−writeWith :: forall m a. (MonadIO m, Storable a)
1892+writeWith :: forall m a. (MonadIO m, Unboxed a)
18931893 => Int -> Fold m a (Array a)
18941894-- writeWith n = FL.rmapM rightSize $ appendWith (* 2) (newArray n)
18951895writeWith elemCount =
@@ -1928,7 +1928,7 @@ writeWith elemCount =
19281928--
19291929-- @since 0.7.0
19301930{-# INLINE write #-}
1931−write :: forall m a. (MonadIO m, Storable a) => Fold m a (Array a)
1931+write :: forall m a. (MonadIO m, Unboxed a) => Fold m a (Array a)
19321932write = writeWith (allocBytesToElemCount (undefined :: a) arrayChunkBytes)
19331933
19341934-------------------------------------------------------------------------------
@@ -1940,7 +1940,7 @@ write = writeWith (allocBytesToElemCount (undefined :: a) arrayChunkBytes)
19401940-- >>> fromStreamDN n = StreamD.fold (Array.writeN n)
19411941--
19421942{-# INLINE_NORMAL fromStreamDN #-}
1943−fromStreamDN :: forall m a. (MonadIO m, Storable a)
1943+fromStreamDN :: forall m a. (MonadIO m, Unboxed a)
19441944 => Int -> D.Stream m a -> m (Array a)
19451945-- fromStreamDN n = D.fold (writeN n)
19461946fromStreamDN limit str = do
@@ -1960,14 +1960,14 @@ fromStreamDN limit str = do
19601960--
19611961-- @since 0.7.0
19621962{-# INLINABLE fromListN #-}
1963−fromListN :: (MonadIO m, Storable a) => Int -> [a] -> m (Array a)
1963+fromListN :: (MonadIO m, Unboxed a) => Int -> [a] -> m (Array a)
19641964fromListN n xs = fromStreamDN n $ D.fromList xs
19651965
19661966-- | Like fromListN but writes the array in reverse order.
19671967--
19681968-- /Pre-release/
19691969{-# INLINE fromListRevN #-}
1970−fromListRevN :: (MonadIO m, Storable a) => Int -> [a] -> m (Array a)
1970+fromListRevN :: (MonadIO m, Unboxed a) => Int -> [a] -> m (Array a)
19711971fromListRevN n xs = D.fold (writeRevN n) $ D.fromList xs
19721972
19731973-------------------------------------------------------------------------------
@@ -1975,14 +1975,14 @@ fromListRevN n xs = D.fold (writeRevN n) $ D.fromList xs
19751975-------------------------------------------------------------------------------
19761976
19771977{-# INLINE arrayStreamKLength #-}
1978−arrayStreamKLength :: (Monad m, Storable a) => K.Stream m (Array a) -> m Int
1978+arrayStreamKLength :: (Monad m, Unboxed a) => K.Stream m (Array a) -> m Int
19791979arrayStreamKLength as = K.foldl' (+) 0 (K.map length as)
19801980
19811981-- | Convert an array stream to an array. Note that this requires peak memory
19821982-- that is double the size of the array stream.
19831983--
19841984{-# INLINE fromArrayStreamK #-}
1985−fromArrayStreamK :: (Storable a, MonadIO m) =>
1985+fromArrayStreamK :: (Unboxed a, MonadIO m) =>
19861986 K.Stream m (Array a) -> m (Array a)
19871987fromArrayStreamK as = do
19881988 len <- arrayStreamKLength as
@@ -2002,14 +2002,14 @@ fromArrayStreamK as = do
20022002-- >>> fromStreamD = StreamD.fold Array.write
20032003--
20042004{-# INLINE fromStreamD #-}
2005−fromStreamD :: (MonadIO m, Storable a) => D.Stream m a -> m (Array a)
2005+fromStreamD :: (MonadIO m, Unboxed a) => D.Stream m a -> m (Array a)
20062006fromStreamD m = arrayStreamKFromStreamD m >>= fromArrayStreamK
20072007
20082008-- | Create an 'Array' from a list. The list must be of finite size.
20092009--
20102010-- @since 0.7.0
20112011{-# INLINE fromList #-}
2012−fromList :: (MonadIO m, Storable a) => [a] -> m (Array a)
2012+fromList :: (MonadIO m, Unboxed a) => [a] -> m (Array a)
20132013fromList xs = fromStreamD $ D.fromList xs
20142014
20152015-- XXX We are materializing the whole list first for getting the length. Check
@@ -2017,7 +2017,7 @@ fromList xs = fromStreamD $ D.fromList xs
20172017
20182018-- | Like 'fromList' but writes the contents of the list in reverse order.
20192019{-# INLINE fromListRev #-}
2020−fromListRev :: (MonadIO m, Storable a) => [a] -> m (Array a)
2020+fromListRev :: (MonadIO m, Unboxed a) => [a] -> m (Array a)
20212021fromListRev xs = fromListRevN (Prelude.length xs) xs
20222022
20232023-------------------------------------------------------------------------------
@@ -2042,7 +2042,7 @@ putSliceUnsafe src srcStartBytes dst dstStartBytes lenBytes = liftIO $ do
20422042
20432043-- | Copy two arrays into a newly allocated array.
20442044{-# INLINE spliceCopy #-}
2045−spliceCopy :: forall m a. (MonadIO m, Storable a) =>
2045+spliceCopy :: forall m a. (MonadIO m, Unboxed a) =>
20462046 Array a -> Array a -> m (Array a)
20472047spliceCopy arr1 arr2 = liftIO $ do
20482048 let start1 = arrStart arr1
@@ -2084,7 +2084,7 @@ spliceUnsafe dst src =
20842084--
20852085-- /Pre-release/
20862086{-# INLINE spliceWith #-}
2087−spliceWith :: forall m a. (MonadIO m, Storable a) =>
2087+spliceWith :: forall m a. (MonadIO m, Unboxed a) =>
20882088 (Int -> Int -> Int) -> Array a -> Array a -> m (Array a)
20892089spliceWith sizer dst@(Array _ start end bound) src = do
20902090{-
@@ -2118,7 +2118,7 @@ spliceWith sizer dst@(Array _ start end bound) src = do
21182118--
21192119-- /Pre-release/
21202120{-# INLINE splice #-}
2121−splice :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
2121+splice :: (MonadIO m, Unboxed a) => Array a -> Array a -> m (Array a)
21222122splice = spliceWith (+)
21232123
21242124-- | Like 'append' but the growth of the array is exponential. Whenever a new
@@ -2132,7 +2132,7 @@ splice = spliceWith (+)
21322132--
21332133-- /Pre-release/
21342134{-# INLINE spliceExp #-}
2135−spliceExp :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
2135+spliceExp :: (MonadIO m, Unboxed a) => Array a -> Array a -> m (Array a)
21362136spliceExp = spliceWith (\l1 l2 -> max (l1 * 2) (l1 + l2))
21372137
21382138-------------------------------------------------------------------------------
@@ -2171,7 +2171,7 @@ breakOn sep arr@Array{..} = asPtrUnsafe arr $ \p -> liftIO $ do
21712171-- specified index @i@ is the first index of the second slice.
21722172--
21732173-- @since 0.7.0
2174−splitAt :: forall a. Storable a => Int -> Array a -> (Array a, Array a)
2174+splitAt :: forall a. Unboxed a => Int -> Array a -> (Array a, Array a)
21752175splitAt i arr@Array{..} =
21762176 let maxIndex = length arr - 1
21772177 in if i < 0
@@ -2208,7 +2208,7 @@ splitAt i arr@Array{..} =
22082208--
22092209castUnsafe ::
22102210#ifdef DEVBUILD
2211− Storable b =>
2211+ Unboxed b =>
22122212#endif
22132213 Array a -> Array b
22142214castUnsafe (Array contents start end bound) =
@@ -2227,7 +2227,7 @@ asBytes = castUnsafe
22272227--
22282228-- /Pre-release/
22292229--
2230−cast :: forall a b. Storable b => Array a -> Maybe (Array b)
2230+cast :: forall a b. Unboxed b => Array a -> Maybe (Array b)
22312231cast arr =
22322232 let len = byteLength arr
22332233 r = len `mod` SIZE_OF(b)
@@ -2316,7 +2316,7 @@ cmp arr1 arr2 =
23162316-- NFData
23172317-------------------------------------------------------------------------------
23182318
2319−-- This is a Storable array, we cannot have unevaluated data in it so this is
2319+-- This is an Unboxed array, we cannot have unevaluated data in it so this is
23202320-- just a no op.
23212321instance NFData (Array a) where
23222322 {-# INLINE rnf #-}
@@ -2330,7 +2330,7 @@ instance NFData1 Array where
23302330--
23312331-- /Pre-release/
23322332{-# INLINE strip #-}
2333−strip :: forall a m. (Storable a, MonadIO m) =>
2333+strip :: forall a m. (Unboxed a, MonadIO m) =>
23342334 (a -> Bool) -> Array a -> m (Array a)
23352335strip eq arr@Array{..} = liftIO $ do
23362336 st <- getStart arrStart
@@ -2374,7 +2374,7 @@ strip eq arr@Array{..} = liftIO $ do
23742374--
23752375-- /Pre-release/
23762376{-# INLINE bubble #-}
2377−bubble :: (MonadIO m, Storable a) => (a -> a -> Ordering) -> Array a -> m ()
2377+bubble :: (MonadIO m, Unboxed a) => (a -> a -> Ordering) -> Array a -> m ()
23782378bubble cmp0 arr =
23792379 when (l > 1) $ do
23802380 x <- getIndexUnsafe (l - 1) arr