Skip to content

Commit 5cf7dc8

Browse files
committed
Fix compilation errors
1 parent e2ffbca commit 5cf7dc8

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

image/shared/src/main/scala/eu/joaocosta/minart/graphics/image/helpers/State.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ sealed trait State[S, +E, +A] {
99
def validate[EE >: E](test: A => Boolean, failure: A => EE): State[S, EE, A] =
1010
flatMap(x => if (test(x)) State.pure(x) else State.error(failure(x)))
1111
def collect[EE >: E, B](f: PartialFunction[A, B], failure: A => EE): State[S, EE, B] = {
12-
val pf = f.andThen(State.pure[S, B]).orElse((x: A) => State.error[S, EE](failure(x)))
12+
val pf =
13+
f.andThen((x: B) => State.pure[S, B](x)).orElse[A, State[S, EE, B]]((x: A) => State.error[S, EE](failure(x)))
1314
flatMap(pf)
1415
}
1516
def modify(f: S => S): State[S, E, A] =

image/shared/src/main/scala/eu/joaocosta/minart/graphics/image/helpers/package.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ package object helpers {
6060
State.modify(_.drop(n))
6161

6262
val readByte: ParseState[String, Option[Int]] = State { bytes =>
63-
val hd = bytes.nextOption
63+
val hd = bytes.nextOption()
6464
bytes -> hd
6565
}
6666

@@ -71,10 +71,10 @@ package object helpers {
7171

7272
def readWhile(p: Int => Boolean): ParseState[Nothing, List[Int]] = State { bytes =>
7373
val buffer = List.newBuilder[Int]
74-
var head = bytes.nextOption
74+
var head = bytes.nextOption()
7575
while (head.exists(p)) {
7676
buffer += head.get
77-
head = bytes.nextOption
77+
head = bytes.nextOption()
7878
}
7979
(head.iterator ++ bytes) -> buffer.result()
8080
}

0 commit comments

Comments
 (0)