File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ lazy val root = project
5
5
description := " Example sbt project that compiles using Scala 3" ,
6
6
version := " 0.1.0" ,
7
7
scalaVersion := " 3.1.3" ,
8
+ scalacOptions ++= Seq (" -deprecation" ),
8
9
libraryDependencies += " org.scalameta" %% " munit" % " 0.7.29" % Test
9
10
)
Original file line number Diff line number Diff line change @@ -12,17 +12,17 @@ object GivenInstances:
12
12
13
13
def apply [A ](using parser : StringParser [A ]): StringParser [A ] = parser
14
14
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 ] {
16
16
override def parse (s : String ): Try [A ] = f(s)
17
17
}
18
18
19
19
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))
21
21
22
22
given optionParser [A ](using parser : => StringParser [A ]): StringParser [Option [A ]] = new StringParser [Option [A ]] {
23
23
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
26
26
}
27
27
28
28
def test (): Unit =
You can’t perform that action at this time.
0 commit comments