Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Align Task and Task.Result with Swift 5 Result #274

Merged
merged 6 commits into from
Jan 16, 2019

Conversation

zwaldowski
Copy link
Contributor

@zwaldowski zwaldowski commented Jan 13, 2019

What's in this pull request?

Completes #271.

  • Either.Left is no longer an associated type. Post-Swift 5, we can add the associated type but not change one, so we leave it as an alias for Error.
  • Task.Result.extract() becomes get().
  • Task.Result.withValues(ifLeft:ifRight:) is removed in favor of get().
  • Task.Result.init(from:) becomes Task.Result.init(catching:).
  • Task.Result.map(_:) and Task.Result.flatMap(_:) no longer do any magic around throws.
  • Adds Task.Result.mapError(_:) and Task.Result.flatMapError(_:).
  • Task<SuccessValue> becomes Task<Success>, including Task.Result.

Testing

Improves coverage of TaskResult and combines together its scattered sources of testing.

API Changes

Yes, it does. Details above. Here, we're supporting upgrading from Deferred 3 with @availability, but not previous betas (sorry).

The intent here is that, although we plan to release Deferred 4 soon, we want to ease pain for upgrading to both it and the upcoming Swift 5.

@zwaldowski zwaldowski added this to the 4.0 milestone Jan 13, 2019
@zwaldowski zwaldowski changed the title WIP: Align TaskResult with Swift 5 Result Align Task and Task.Result with Swift 5 Result Jan 14, 2019
@zwaldowski zwaldowski merged commit 22283b5 into master Jan 16, 2019
@zwaldowski zwaldowski deleted the zwaldowski/swift-5-naming branch January 16, 2019 15:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant