Skip to content

Commit

Permalink
changes Left and Right field-backed properties isRight and isLeft to …
Browse files Browse the repository at this point in the history
…function-only backed ones
  • Loading branch information
ricmf committed Jan 25, 2018
1 parent ff36cc7 commit 058af92
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions arrow-core/src/main/kotlin/arrow/core/Either.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ import arrow.legacy.*
*/
@Suppress("DataClassPrivateConstructor")
data class Left<out A, out B> @PublishedApi internal constructor(val a: A) : Either<A, B>() {
override val isLeft = true
override val isRight = false
override val isLeft
get() = true
override val isRight
get() = false

companion object {
inline operator fun <A> invoke(a: A): Either<A, Nothing> = Left(a)
Expand All @@ -165,8 +167,10 @@ import arrow.legacy.*
*/
@Suppress("DataClassPrivateConstructor")
data class Right<out A, out B> @PublishedApi internal constructor(val b: B) : Either<A, B>() {
override val isLeft = false
override val isRight = true
override val isLeft
get() = false
override val isRight
get() = true

companion object {
inline operator fun <B> invoke(b: B): Either<Nothing, B> = Right(b)
Expand Down

0 comments on commit 058af92

Please sign in to comment.