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

BrightFutures 2.0 #51

Merged
merged 63 commits into from
Jun 27, 2015
Merged

BrightFutures 2.0 #51

merged 63 commits into from
Jun 27, 2015

Conversation

Thomvis
Copy link
Owner

@Thomvis Thomvis commented May 14, 2015

Open questions:

  • Should Future<T, E>.succeeded(_: T) return a Future<T, NoError> or a Future<T, E>?
  • Do we need an Either (or EitherError)?

Todo:

  • Update README

@Thomvis
Copy link
Owner Author

Thomvis commented May 18, 2015

I've finished the first stab at getting rid of NSError in the framework and it has turned out quite nice, I think. One thing that I'm not so happy about yet is that I need EitherError where two types of errors could be returned, e.g.

public func filter(p: (T -> Bool)) -> Future<T, EitherError<E, BrightFuturesError>> {
. It might not be a very big deal and I will think about it more. Feedback is welcome!

public let BrightFuturesErrorDomain = "nl.thomvis.BrightFutures"

/// An enum representing every possible error code for errors returned by BrightFutures
public enum BrightFuturesError: ErrorType, Equatable {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might consider adding an External case to this enum which carries an ErrorType:

case External(ErrorType)

public var nsError: NSError {
    switch self {
    
    case let .External(e):
        return e
    }
}

This would seem to obviate the need for EitherError, which would yield a simpler API.

@Thomvis Thomvis merged commit fa2dcfa into master Jun 27, 2015
@Thomvis Thomvis deleted the 2.0-development branch June 27, 2015 20:07
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.

None yet

3 participants