Skip to content

Commit

Permalink
Merge pull request #162 from Kevin-Lee/docs/either-fix
Browse files Browse the repository at this point in the history
Update: docs - `either.md`: fix `fold`
  • Loading branch information
kevin-lee committed Dec 30, 2021
2 parents 5db2066 + 63292b1 commit f5a3a46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions website/docs/types/either.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ The `Right` case,
import j8plus.types.Either;

final Either<String, Integer> errorMsgOrNum = Either.right(999);
// Either<String, Integer> = Right(999)
// Either<String, Long> = Right(999)

errorMsgOrNum.fold(err -> 0, n -> n);
// Integer = 999
Expand All @@ -243,7 +243,7 @@ The `Left` case,
import j8plus.types.Either;

final Either<String, Integer> errorMsgOrNum = Either.left("Error message");
// Either<String, Integer> = Left(Error message)
// Either<String, Long> = Left(Error message)

errorMsgOrNum.fold(err -> 0, n -> n);
// Integer = 0
Expand All @@ -255,7 +255,7 @@ import j8plus.types.Either;
import java.time.Instant;

final Either<String, Long> errorMsgOrMillis = Either.right(1638316800000L);
// Either<String, Integer> = Right(1638316800000L)
// Either<String, Long> = Right(1638316800000L)

errorMsgOrMillis.fold(err -> Instant.now(), millis -> Instant.ofEpochMilli(millis));
// Instant = 2021-12-01T00:00:00Z
Expand All @@ -270,7 +270,7 @@ import j8plus.types.Either;
import java.time.Instant;

final Either<String, Long> errorMsgOrMillis = Either.left("Error message");
// Either<String, Integer> = Left(Error message)
// Either<String, Long> = Left(Error message)

errorMsgOrMillis.fold(err -> Instant.now(), millis -> Instant.ofEpochMilli(millis));
// Instant = 2021-12-30T09:15:24.033117Z
Expand Down

0 comments on commit f5a3a46

Please sign in to comment.