Skip to content

Commit

Permalink
Disable fusing of slice function (see #257). Fixes:
Browse files Browse the repository at this point in the history
* Streaming causing bounds to not be checked, thus not failing slicing.
  Which differed from the semantics of `slice` when compiled with -O0
* Out of memory explosion when size supplied to `slice` is too high
  • Loading branch information
lehins authored and cartazio committed Jan 31, 2020
1 parent 50443e1 commit 8f8309a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Data/Vector/Generic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,12 @@ unsafeDrop :: Vector v a => Int -> v a -> v a
{-# INLINE unsafeDrop #-}
unsafeDrop n v = unsafeSlice n (length v - n) v

{-# RULES

"slice/new [Vector]" forall i n p.
slice i n (new p) = new (New.slice i n p)
-- Turned off due to: https://github.com/haskell/vector/issues/257
-- "slice/new [Vector]" forall i n p.
-- slice i n (new p) = new (New.slice i n p)

{-# RULES

"init/new [Vector]" forall p.
init (new p) = new (New.init p)
Expand Down

0 comments on commit 8f8309a

Please sign in to comment.