package com.mikebull94.result /** * - Elm: [Result](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Result) * - Haskell: [Data.Either](https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Either.html) */ sealed class Result class Ok internal constructor(val value: V) : Result() { override fun equals(other: Any?): Boolean { if (this === other) return true if (javaClass != other?.javaClass) return false other as Ok<*, *> if (value != other.value) return false return true } override fun hashCode() = value?.hashCode() ?: 0 override fun toString() = "Result.Ok($value)" } class Error internal constructor(val error: E) : Result() { override fun equals(other: Any?): Boolean { if (this === other) return true if (javaClass != other?.javaClass) return false other as Error<*, *> if (error != other.error) return false return true } override fun hashCode() = error?.hashCode() ?: 0 override fun toString() = "Result.Error($error)" }