aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorAmir Saeid <amir@glgdgt.com>2026-02-14 20:49:00 +0000
committerAmir Saeid <amir@glgdgt.com>2026-02-14 20:49:00 +0000
commitf08bf168ba07c8c72cfc22127d00414247ec12b3 (patch)
tree99234a6ebb4f8fd51c68cfcd730574c5310c4c61 /core/src/main
parent64e4b269c53faa70551e41c6d77ccf17ef96a68e (diff)
Fix Scala 3 compilation issue
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/scala/com/codiff/fairstream/Fair.scala17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/src/main/scala/com/codiff/fairstream/Fair.scala b/core/src/main/scala/com/codiff/fairstream/Fair.scala
index 586e296..3eab3e0 100644
--- a/core/src/main/scala/com/codiff/fairstream/Fair.scala
+++ b/core/src/main/scala/com/codiff/fairstream/Fair.scala
@@ -58,10 +58,11 @@ object Fair {
case c: Choice[A @unchecked] => Choice(c.a, mplus(right, c.rest))
case inc: Incomplete[A @unchecked] =>
right match {
- case Nil => inc
- case One(b) => Choice(b, inc.step)
- case Choice(b, r2) => Choice(b, mplus(inc.step, r2))
- case Incomplete(j) => Incomplete(mplus(inc.step, j))
+ case Nil => inc
+ case One(b) => Choice(b, inc.step)
+ case c: Choice[A @unchecked] => Choice(c.a, mplus(inc.step, c.rest))
+ case inc2: Incomplete[A @unchecked] =>
+ Incomplete(mplus(inc.step, inc2.step))
}
}
@@ -77,11 +78,11 @@ object Fair {
stream match {
case Nil => acc.reverse
case One(a) => (a :: acc).reverse
- case Choice(a, r) =>
- runM(maxDepth, maxResults.map(_ - 1), r, a :: acc)
- case Incomplete(i) =>
+ case c: Choice[A @unchecked] =>
+ runM(maxDepth, maxResults.map(_ - 1), c.rest, c.a :: acc)
+ case i: Incomplete[A @unchecked] =>
if (maxDepth.exists(_ <= 0)) acc.reverse
- else runM(maxDepth.map(_ - 1), maxResults, i, acc)
+ else runM(maxDepth.map(_ - 1), maxResults, i.step, acc)
}
}