Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROPOSAL] Option API deprecation, and preparation for 2.x.x #2913

Merged
merged 33 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c675811
Deprecate foldable methods
franciscodr Feb 2, 2023
268c995
Deprecate functor/applicative/monad methods
franciscodr Feb 4, 2023
8858cec
Update API files
franciscodr Feb 4, 2023
ea87f40
Apply suggestions from code review
franciscodr Feb 4, 2023
fb8a3aa
Add getOrNull method
franciscodr Feb 4, 2023
439773d
Update API files
franciscodr Feb 4, 2023
2d4cb40
Restore isEmpty implementation
franciscodr Feb 4, 2023
4165ee9
Update API files
franciscodr Feb 4, 2023
8e8c092
Deprecate applicative/monad error methods
franciscodr Feb 4, 2023
78b4384
Deprecate utility methods
franciscodr Feb 5, 2023
e9ce01b
Merge remote-tracking branch 'origin/main' into fd-option-API
franciscodr Feb 6, 2023
37bbc40
Merge remote-tracking branch 'origin/main' into fd-option-API
franciscodr Feb 6, 2023
356a273
Deprecate assign methods
franciscodr Feb 6, 2023
7fc257e
Fix outdated knit files
franciscodr Feb 6, 2023
3288486
Merge branch 'main' into fd-option-API
franciscodr Feb 6, 2023
1d1ae2c
Merge branch 'main' into fd-option-API
nomisRev Feb 6, 2023
8198fce
Using the inline option DSL
franciscodr Feb 6, 2023
b0f9ff1
Change redeem implementation for Either and Option
franciscodr Feb 6, 2023
b05b8ea
Merge branch 'main' into fd-option-API
franciscodr Feb 6, 2023
49a018b
Fix wrong deprecation replacement
franciscodr Feb 7, 2023
58b51a4
Revert Nullable.toOption deprecation
franciscodr Feb 7, 2023
3936647
Add missing contracts
franciscodr Feb 7, 2023
241d601
Update API files
franciscodr Feb 7, 2023
b4fad18
Merge branch 'main' into fd-option-API
nomisRev Feb 8, 2023
d4f5bc4
Revert filterIsInstance deprecation
franciscodr Feb 8, 2023
df95be0
Add isNone and isSome methods for Option
franciscodr Feb 8, 2023
6599bf3
Update API files
franciscodr Feb 8, 2023
6408a19
Trigger build
franciscodr Feb 9, 2023
4a9c115
Update API files
franciscodr Feb 9, 2023
965395b
Convert isSome into an instance method
franciscodr Feb 9, 2023
3abcb1e
Restore abstract isEmpty function for Option
franciscodr Feb 9, 2023
2911df7
Merge branch 'main' into fd-option-API
franciscodr Feb 9, 2023
cf57557
Merge branch 'main' into fd-option-API
nomisRev Feb 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -903,14 +903,20 @@ public abstract class arrow/core/Option {
public final fun foldLeft (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
public final fun foldMap (Larrow/typeclasses/Monoid;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun fromNullable (Ljava/lang/Object;)Larrow/core/Option;
public final fun getOrNull ()Ljava/lang/Object;
public static final fun invoke (Ljava/lang/Object;)Larrow/core/Option;
public final fun isDefined ()Z
public abstract fun isEmpty ()Z
public final fun isNone ()Z
public final fun isNotEmpty ()Z
public final fun isSome ()Z
public final fun isSome (Lkotlin/jvm/functions/Function1;)Z
public static final fun lift (Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
public final fun map (Lkotlin/jvm/functions/Function1;)Larrow/core/Option;
public final fun mapNotNull (Lkotlin/jvm/functions/Function1;)Larrow/core/Option;
public final fun nonEmpty ()Z
public final fun onNone (Lkotlin/jvm/functions/Function0;)Larrow/core/Option;
public final fun onSome (Lkotlin/jvm/functions/Function1;)Larrow/core/Option;
public final fun orNull ()Ljava/lang/Object;
public final fun padZip (Larrow/core/Option;)Larrow/core/Option;
public final fun padZip (Larrow/core/Option;Lkotlin/jvm/functions/Function2;)Larrow/core/Option;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2199,18 +2199,18 @@ public inline fun <A, B> Either<A, B>.handleError(f: (A) -> B): Either<A, B> {
}

@Deprecated(
RedundantAPI + "Prefer the new recover API",
RedundantAPI + "Prefer using the Either DSL or explicit fold with right",
ReplaceWith(
"map(fa).recover { a -> fe(a) }",
"arrow.core.recover"
"fold({ a -> fe(a) }, fa).right()",
"arrow.core.right"
)
)
public inline fun <A, B, C> Either<A, B>.redeem(fe: (A) -> C, fa: (B) -> C): Either<A, C> {
contract {
callsInPlace(fe, InvocationKind.AT_MOST_ONCE)
callsInPlace(fa, InvocationKind.AT_MOST_ONCE)
}
return map(fa).recover { a -> fe(a) }
return fold({ a -> fe(a) }, fa).right()
}

public operator fun <A : Comparable<A>, B : Comparable<B>> Either<A, B>.compareTo(other: Either<A, B>): Int =
Expand Down
Loading