Skip to content

Commit 4231225

Browse files
committed
scala-core-fp module migrated to Scala 3
1 parent b5731ea commit 4231225

33 files changed

+11
-10
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ lazy val scala_core_oop = (project in file("scala-core-modules/scala-core-oop"))
113113
lazy val scala_core_fp = (project in file("scala-core-modules/scala-core-fp"))
114114
.settings(
115115
name := "scala-core-fp",
116+
scalaVersion := scala3Version,
116117
libraryDependencies ++=
117118
Seq(catsEffect, jUnitInterface) ++ scalaTestDeps
118119
)
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.scalatest.matchers.should.Matchers
66
class CurryingUnitTest extends Matchers {
77

88
@Test
9-
def givenMultipleArgumentsFunction_whenCurried_thenReturnCurriedFunction() {
9+
def givenMultipleArgumentsFunction_whenCurried_thenReturnCurriedFunction() = {
1010
val sum: (Int, Int) => Int = (x, y) => x + y
1111
val curriedSum: Int => Int => Int = sum.curried
1212

@@ -15,7 +15,7 @@ class CurryingUnitTest extends Matchers {
1515
}
1616

1717
@Test
18-
def givenMultipleArgumentsMethod_whenCurried_thenReturnCurriedFunction() {
18+
def givenMultipleArgumentsMethod_whenCurried_thenReturnCurriedFunction() = {
1919
def sum(x: Int, y: Int): Int = x + y
2020

2121
val curriedSum: Int => Int => Int = (sum _).curried
@@ -25,7 +25,7 @@ class CurryingUnitTest extends Matchers {
2525
}
2626

2727
@Test
28-
def givenMultipleArgumentListsMethod_whenCurried_thenReturnCurriedFunction() {
28+
def givenMultipleArgumentListsMethod_whenCurried_thenReturnCurriedFunction() = {
2929
def sum(x: Int)(y: Int): Int = x + y
3030

3131
val curriedSum: Int => Int => Int = sum
@@ -35,15 +35,15 @@ class CurryingUnitTest extends Matchers {
3535
}
3636

3737
@Test
38-
def givenCurriedFunction_whenPartialApplied_thenReturnLowerArityFunction() {
38+
def givenCurriedFunction_whenPartialApplied_thenReturnLowerArityFunction() = {
3939
val sum: Int => Int => Int = x => y => x + y
4040
val increment: Int => Int = sum(1)
4141

4242
increment(1) shouldBe 2
4343
}
4444

4545
@Test
46-
def givenMultipleArgumentListsMethod_whenPartialApplied_thenReturnLowerArityMethod() {
46+
def givenMultipleArgumentListsMethod_whenPartialApplied_thenReturnLowerArityMethod() = {
4747
def sum(x: Int)(y: Int): Int = x + y
4848

4949
val increment: Int => Int = sum(1)
@@ -52,7 +52,7 @@ class CurryingUnitTest extends Matchers {
5252
}
5353

5454
@Test
55-
def givenMultipleArgumentsFindMethod_whenCalled_thenPredicateFunctionNeedsExplicitType() {
55+
def givenMultipleArgumentsFindMethod_whenCalled_thenPredicateFunctionNeedsExplicitType() = {
5656
def find[A](xs: List[A], predicate: A => Boolean): Option[A] = {
5757
xs match {
5858
case Nil => None
@@ -65,7 +65,7 @@ class CurryingUnitTest extends Matchers {
6565
}
6666

6767
@Test
68-
def givenMultipleArgumentListFindMethod_whenCalled_thenPredicateFunctionDoesNotNeedExplicitType() {
68+
def givenMultipleArgumentListFindMethod_whenCalled_thenPredicateFunctionDoesNotNeedExplicitType() = {
6969
def find[A](xs: List[A])(predicate: A => Boolean): Option[A] = {
7070
xs match {
7171
case Nil => None
@@ -78,7 +78,7 @@ class CurryingUnitTest extends Matchers {
7878
}
7979

8080
@Test
81-
def givenGenericMultipleArgumentListSumMethod_whenPartialApplied_thenReturnSimpleMethods() {
81+
def givenGenericMultipleArgumentListSumMethod_whenPartialApplied_thenReturnSimpleMethods() = {
8282
def sumF(f: Int => Int)(x: Int, y: Int): Int = f(x) + f(y)
8383
val sum: (Int, Int) => Int = sumF(identity)
8484
val sumSquare: (Int, Int) => Int = sumF(x => x * x)
@@ -92,15 +92,15 @@ class CurryingUnitTest extends Matchers {
9292
}
9393

9494
@Test
95-
def givenMultipleArgumentsFunction_whenUseItAsOneArgumentFunction_thenNeedsExplicitArgumentPassing() {
95+
def givenMultipleArgumentsFunction_whenUseItAsOneArgumentFunction_thenNeedsExplicitArgumentPassing() = {
9696
val sum: (Int, Int) => Int = (x, y) => x + y
9797
val numbers: List[Int] = List(1, 2, 3)
9898

9999
numbers.map(n => sum(1, n)) shouldBe List(2, 3, 4)
100100
}
101101

102102
@Test
103-
def givenCurriedFunction_whenUseItAsOneArgumentFunction_thenDoesNotNeedExplicitArgumentPassing() {
103+
def givenCurriedFunction_whenUseItAsOneArgumentFunction_thenDoesNotNeedExplicitArgumentPassing() = {
104104
val curriedSum: Int => Int => Int = x => y => x + y
105105
val numbers: List[Int] = List(1, 2, 3)
106106

0 commit comments

Comments
 (0)