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

[Idea] NoValue enum #389

Closed
ikesyo opened this issue May 15, 2017 · 9 comments
Closed

[Idea] NoValue enum #389

ikesyo opened this issue May 15, 2017 · 9 comments
Labels

Comments

@ikesyo
Copy link
Member

ikesyo commented May 15, 2017

This is similar to NoError enum. With this one can write something like this:

let noValueProducer1 = SignalProducer<NoValue, NoError>.empty
let noValueProducer2 = SignalProducer<NoValue, FooError>(error: FooError())
let noValueProducer3 = SignalProducer<NoValue, FooError>(value: ...) // Cannot be called

typealias Completable<E> = SignalProducer<NoValue, E>

We may replace Signal/Producer<(), Error> with Signal/Producer<NoValue, Error>.

@andersio
Copy link
Member

andersio commented May 15, 2017

We can use Never.

@ikesyo
Copy link
Member Author

ikesyo commented May 15, 2017

Ah that makes sense.

@andersio
Copy link
Member

Hmm, NoValue reads better though. Moreover, Never for now is just intended for return types, and it is not yet a real bottom type.

@mdiep
Copy link
Contributor

mdiep commented May 15, 2017

I think Never reads fine. If that provides the same guarantee, I'd prefer it.

@andersio
Copy link
Member

andersio commented May 15, 2017

Never is just NoError (uninhabited type) with a bit compiler sugar AFAIK.

@mdiep
Copy link
Contributor

mdiep commented May 31, 2017

I believe this is resolved by #392. I don't see any other operators that could use Never.

@mdiep mdiep closed this as completed May 31, 2017
@andersio
Copy link
Member

andersio commented May 31, 2017

flatMapError could use Never. 🙂 e.g.

SignalProducer<Never, E1>.flatMapError -> SignalProducer<U, E2>

We can also add an equivalent of promoteError for Never.

@mdiep mdiep reopened this May 31, 2017
@andersio
Copy link
Member

andersio commented Jun 1, 2017

Ah, and a new overload of startWith* and observe* that returns a Result<(), Error> (completed or failed).

Just found that the conventional start is enough by asserting event.error.

@RuiAAPeres
Copy link
Member

Hello. 👋 Thanks for opening this issue. Due to inactivity, we will soft close the issue. If you feel that it should remain open, please let us know. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants