Move factory methods to Result.kt

This commit is contained in:
Michael Bull 2017-10-21 04:37:37 +01:00
parent b1ac605d05
commit c9a7d16562
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +0,0 @@
package com.mikebull94.result
fun <V> ok(value: V) = Ok<V, Nothing>(value)
fun <E> error(error: E) = Error<Nothing, E>(error)

View File

@ -6,6 +6,9 @@ package com.mikebull94.result
*/ */
sealed class Result<out V, out E> sealed class Result<out V, out E>
fun <V> ok(value: V) = Ok<V, Nothing>(value)
fun <E> error(error: E) = Error<Nothing, E>(error)
class Ok<out V, out E> internal constructor(val value: V) : Result<V, E>() { class Ok<out V, out E> internal constructor(val value: V) : Result<V, E>() {
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true