Skip to content

Commit 643fc91

Browse files
committed
0.9.5
1 parent 1d661a2 commit 643fc91

File tree

10 files changed

+25
-26
lines changed

10 files changed

+25
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Then you can use funKTionale dependency
3636
<dependency>
3737
<groupId>org.funktionale</groupId>
3838
<artifactId>funktionale</artifactId>
39-
<version>0.9</version>
39+
<version>0.9.5</version>
4040
</dependency>
4141
```
4242

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<groupId>org.funktionale</groupId>
2424
<artifactId>funktionale</artifactId>
25-
<version>0.9</version>
25+
<version>0.9.5</version>
2626
<packaging>jar</packaging>
2727
<name>funKTionale</name>
2828
<description>Functional constructs and utilities for Kotlin</description>
@@ -68,7 +68,7 @@
6868
</developer>
6969
</developers>
7070
<properties>
71-
<kotlin.version>1.0.3</kotlin.version>
71+
<kotlin.version>1.0.4</kotlin.version>
7272
</properties>
7373
<dependencies>
7474
<dependency>

src/main/kotlin/org/funktionale/either/Disjunction.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ sealed class Disjunction<out L : Any, out R : Any> : EitherLike {
9191
override fun component1(): L = value
9292
override fun component2(): R? = null
9393
override fun equals(other: Any?): Boolean = when (other) {
94-
is Left<*, *> -> value.equals(other.value)
94+
is Left<*, *> -> value == other.value
9595
else -> false
9696
}
9797

@@ -107,7 +107,7 @@ sealed class Disjunction<out L : Any, out R : Any> : EitherLike {
107107
override fun component2(): R = value
108108

109109
override fun equals(other: Any?): Boolean = when (other) {
110-
is Right<*, *> -> value.equals(other.value)
110+
is Right<*, *> -> value == other.value
111111
else -> false
112112
}
113113

src/main/kotlin/org/funktionale/either/Either.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ sealed class Either<out L : Any, out R : Any> : EitherLike {
5454
override fun component2(): R? = null
5555

5656
override fun equals(other: Any?): Boolean = when (other) {
57-
is Left<*, *> -> l.equals(other.l)
57+
is Left<*, *> -> l == other.l
5858
else -> false
5959

6060
}
@@ -69,7 +69,7 @@ sealed class Either<out L : Any, out R : Any> : EitherLike {
6969
override fun component2(): R = r
7070

7171
override fun equals(other: Any?): Boolean = when (other) {
72-
is Right<*, *> -> r.equals(other.r)
72+
is Right<*, *> -> r == other.r
7373
else -> false
7474
}
7575

src/main/kotlin/org/funktionale/memoization/namespace.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private data class MemoizeKey22<out P1, out P2, out P3, out P4, out P5, out P6,
272272
override fun invoke(f: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R) = f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22)
273273
}
274274

275-
private class MemoizedHandler<F, in K : MemoizedCall<F, R>, R : Any>(val f: F) {
275+
private class MemoizedHandler<F, in K : MemoizedCall<F, R>, out R : Any>(val f: F) {
276276
private val m = ConcurrentHashMap<K, R>()
277277
operator fun invoke(k: K): R {
278278
return m[k].toOption().fold({

src/main/kotlin/org/funktionale/option/Option.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ sealed class Option<out T : Any> {
138138
override fun isEmpty() = false
139139

140140
override fun equals(other: Any?): Boolean = when (other) {
141-
is Some<*> -> t.equals(other.get())
141+
is Some<*> -> t == other.get()
142142
is None -> false
143143
else -> false
144144
}
@@ -235,7 +235,7 @@ fun String.firstOption(): Option<Char> {
235235
return firstOrNull().toOption()
236236
}
237237

238-
inline fun <T : Any> Array<out T?>.firstOption(predicate: (T) -> Boolean): Option<T> {
238+
fun <T : Any> Array<out T?>.firstOption(predicate: (T) -> Boolean): Option<T> {
239239
return firstOrNull(predicate.mapNullable()).toOption()
240240
}
241241

@@ -271,19 +271,19 @@ inline fun ShortArray.firstOption(predicate: (Short) -> Boolean): Option<Short>
271271
return firstOrNull(predicate).toOption()
272272
}
273273

274-
inline fun <T : Any> Iterable<T?>.firstOption(predicate: (T) -> Boolean): Option<T> {
274+
fun <T : Any> Iterable<T?>.firstOption(predicate: (T) -> Boolean): Option<T> {
275275
return firstOrNull(predicate.mapNullable()).toOption()
276276
}
277277

278-
inline fun <T : Any> Sequence<T?>.firstOption(predicate: (T) -> Boolean): Option<T> {
278+
fun <T : Any> Sequence<T?>.firstOption(predicate: (T) -> Boolean): Option<T> {
279279
return firstOrNull(predicate.mapNullable()).toOption()
280280
}
281281

282282
inline fun String.firstOption(predicate: (Char) -> Boolean): Option<Char> {
283283
return firstOrNull(predicate).toOption()
284284
}
285285

286-
inline fun <T : Any> ((T) -> Boolean).mapNullable(): (T?) -> Boolean {
286+
fun <T : Any> ((T) -> Boolean).mapNullable(): (T?) -> Boolean {
287287
return { it?.let { this@mapNullable(it) } ?: false }
288288
}
289289

src/main/kotlin/org/funktionale/validation/Validation.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import org.funktionale.either.Disjunction
44

55
class Validation<out E : Any>(vararg disjunctionSequence: Disjunction<E, *>) {
66

7-
87
val failures: List<E> = disjunctionSequence.filter { it.isLeft() }.map { it.swap().get() }
98

109
val hasFailures: Boolean = failures.isNotEmpty()

src/test/kotlin/org/funktionale/either/DisjunctionTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class DisjunctionTest {
7373

7474
@Test fun exists() {
7575
assertTrue(left.swap().exists { it == 5 })
76-
assertFalse(left.exists { it.equals("kotlin") })
76+
assertFalse(left.exists { it == "kotlin" })
7777
}
7878

7979
@Test fun flatMap() {
@@ -82,7 +82,7 @@ class DisjunctionTest {
8282
}
8383

8484
@Test fun map() {
85-
assertEquals(left.swap().map { it.toString() }.get(), "5")
85+
assertEquals(left.swap().map(Int::toString).get(), "5")
8686
assertEquals(right.map { it.length }.get(), 6)
8787
}
8888

@@ -104,7 +104,7 @@ class DisjunctionTest {
104104
}
105105

106106
@Test fun fold() {
107-
assertEquals(left.fold({ it.toString() }, { it }), "5")
107+
assertEquals(left.fold(Int::toString, { it }), "5")
108108
}
109109

110110
@Test fun swap() {

src/test/kotlin/org/funktionale/either/EitherTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class EitherTest {
7373

7474
@Test fun exists() {
7575
assertTrue(left.left().exists { it == 5 })
76-
assertFalse(left.right().exists { it.equals("kotlin") })
76+
assertFalse(left.right().exists { it == "kotlin" })
7777
}
7878

7979
@Test fun flatMap() {
@@ -82,7 +82,7 @@ class EitherTest {
8282
}
8383

8484
@Test fun map() {
85-
assertEquals(left.left().map { it.toString() }.left().get(), "5")
85+
assertEquals(left.left().map(Int::toString).left().get(), "5")
8686
assertEquals(right.right().map { it.length }.right().get(), 6)
8787
}
8888

@@ -104,7 +104,7 @@ class EitherTest {
104104
}
105105

106106
@Test fun fold() {
107-
assertEquals(left.fold({ it.toString() }, { it }), "5")
107+
assertEquals(left.fold(Int::toString){ it }, "5")
108108
}
109109

110110
@Test fun swap() {

src/test/kotlin/org/funktionale/option/OptionTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class OptionTest {
6464
}
6565

6666
@Test fun map() {
67-
assertEquals(getSome().map { it.toUpperCase() }.get(), "KOTLIN")
68-
assertEquals(getNone().map { it.toUpperCase() }, None)
67+
assertEquals(getSome().map(String::toUpperCase).get(), "KOTLIN")
68+
assertEquals(getNone().map(String::toUpperCase), None)
6969

7070
assertEquals(getSome().map(Some(12)) { name, version -> "${name.toUpperCase()} M$version" }.get(), "KOTLIN M12")
7171
assertEquals(getNone().map(Some(12)) { name, version -> "${name.toUpperCase()} M$version" }, None)
@@ -82,14 +82,14 @@ class OptionTest {
8282
}
8383

8484
@Test fun filter() {
85-
assertEquals(getSome().filter { it.equals("java") }, None)
86-
assertEquals(getNone().filter { it.equals("java") }, None)
85+
assertEquals(getSome().filter { it == "java" }, None)
86+
assertEquals(getNone().filter { it == "java" }, None)
8787
assertEquals(getSome().filter { it.startsWith('k') }.get(), "kotlin")
8888
}
8989

9090
@Test fun filterNot() {
91-
assertEquals(getSome().filterNot { it.equals("java") }.get(), "kotlin")
92-
assertEquals(getNone().filterNot { it.equals("java") }, None)
91+
assertEquals(getSome().filterNot { it == "java" }.get(), "kotlin")
92+
assertEquals(getNone().filterNot { it == "java" }, None)
9393
assertEquals(getSome().filterNot { it.startsWith('k') }, None)
9494
}
9595

0 commit comments

Comments
 (0)