Skip to content

Commit 57e4a89

Browse files
authored
Merge pull request #111 from unkarjedy/main
fix deprecation warnings
2 parents 281caac + c05f40c commit 57e4a89

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ lazy val root = project
55
description := "Example sbt project that compiles using Scala 3",
66
version := "0.1.0",
77
scalaVersion := "3.1.3",
8+
scalacOptions ++= Seq("-deprecation"),
89
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test
910
)

src/main/scala/GivenInstances.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ object GivenInstances:
1212

1313
def apply[A](using parser: StringParser[A]): StringParser[A] = parser
1414

15-
private def baseParser[A](f: String Try[A]): StringParser[A] = new StringParser[A] {
15+
private def baseParser[A](f: String => Try[A]): StringParser[A] = new StringParser[A] {
1616
override def parse(s: String): Try[A] = f(s)
1717
}
1818

1919
given stringParser: StringParser[String] = baseParser(Success(_))
20-
given intParser: StringParser[Int] = baseParser(s Try(s.toInt))
20+
given intParser: StringParser[Int] = baseParser(s => Try(s.toInt))
2121

2222
given optionParser[A](using parser: => StringParser[A]): StringParser[Option[A]] = new StringParser[Option[A]] {
2323
override def parse(s: String): Try[Option[A]] = s match
24-
case "" Success(None) // implicit parser not used.
25-
case str parser.parse(str).map(x Some(x)) // implicit parser is evaluated at here
24+
case "" => Success(None) // implicit parser not used.
25+
case str => parser.parse(str).map(x => Some(x)) // implicit parser is evaluated at here
2626
}
2727

2828
def test(): Unit =

0 commit comments

Comments
 (0)