diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-04-14 08:53:41 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-04-14 08:53:41 -0400 |
commit | 42048b5317b2a31ffc14905f9206b3068282e491 (patch) | |
tree | 74eca3a6397c0215ce4ceed5de1db915fdc80033 | |
parent | 7b808f4c9c3b81158a714dcfa4adcb73fc6826a5 (diff) | |
download | haskell-wip/T18927.tar.gz |
SArr: Fix toListwip/T18927
-rw-r--r-- | compiler/GHC/Data/SArr.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/GHC/Data/SArr.hs b/compiler/GHC/Data/SArr.hs index 8f5b576293..a68ad9cb4d 100644 --- a/compiler/GHC/Data/SArr.hs +++ b/compiler/GHC/Data/SArr.hs @@ -346,7 +346,11 @@ instance Exts.IsList (Slice a) where {-# INLINE fromList #-} fromListN n = slice . fromListN n {-# INLINE fromListN #-} - toList = \sl -> List.drop (s_begin sl) . List.take (s_end sl) . toList $ s_arr sl + toList sl = Exts.build $ go (s_begin sl) (s_end sl) (s_arr sl) + where + go !i0 !i1 arr c z + | i0 < i1 = (arr ! i0) `c` go (i0+1) i1 arr c z + | otherwise = z {-# INLINE toList #-} instance Functor Slice where |