Skip to content

Commit

Permalink
Remove unnecessary clear during sequence merging (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 authored Jan 30, 2023
1 parent 5b53048 commit b55d4be
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ private [deepembedding] final class Seq[A](private [backend] var before: DoublyL
}

private def mergeFromRight(p: Seq[_], into: DoublyLinkedList[StrictParsley[_]]): this.type = {
assume(after.isEmpty || after.size == 1 && (after.head eq p), "after can only contain just p, which is going to get flattened")
after.clear()
into.stealAll(p.before)
Seq.whenNonPure(p.res, into.addOne(_))
into.stealAll(p.after)
Expand Down Expand Up @@ -173,6 +171,7 @@ private [deepembedding] final class Seq[A](private [backend] var before: DoublyL
before = rs1
res = rr
assume(!rr.isInstanceOf[Pure[_]] || rs2.isEmpty, "rs2 is empty when rr is Pure")
assume(after.size == 1 && (after.head eq p), "after can only contain just p, which is going to get flattened, so it can be dropped")
after = rs2
val into = chooseInto(rr)
p match {
Expand Down

0 comments on commit b55d4be

Please sign in to comment.