-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Carrier trait for ? operator #1718
Copy link
Copy link
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.
Type
Fields
Give feedbackNo fields configured for issues without a type.
We accepted an RFC to add the
?operator, that RFC included aCarriertrait to allow applying?to types other thanResult, e.g.,Option. However, we accepted a version of the RFC without that in order to get some actual movement and some experience with the?operator.The bare
?operator is now on the road to stabilisation. We would like to consider adding aCarriertrait and that will require a new RFC. There is in fact a 'dummy' Carrier trait in libcore and used in the implementation of?. However, its purpose is to ensure?is backwards compatible around type inference. It is effectively only implemented forResultand is not intended to be a long-term solution. There are other options for the trait using HKT, variant types, and just existing features. It's unclear what is preferred right now.One important question is whether we should allow conversion between types (e.g.,
ResulttoOption) or whether we should only allow the?operator to work on one type 'at a time'.Links:
? operator RFC PR
? operator tracking issue
Niko's thoughts