-
Notifications
You must be signed in to change notification settings - Fork 77
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
Type annotations: Order of T and E #7
Comments
I agree. Changing the order seems like the right thing to do. When I wrote that I wasn't aware the order was different in Rust than Haskell. |
Does this have any implication for existing code that has been written one way or another? I had assumed the order was |
It only matters if you actually do something with the success or error case that does not comply with the type. If your result type is |
Change order of generic Result types to [T, E]. Fixes #7.
#8 is merged, testing the version on master is welcome. |
In Rust, the Result type is defined as
Result<T, E>
(success case first). In Haskell, it'sEither ConnError a
and in Elm it'sResult error value
(error case first). On the other hand OCaml and F# also put the success case first.When #4 was merged, I did not notice that the type annotation chosen was
Generic[E, T]
. In general I'm fine with the other order, but since we clearly state that the library is inspired by Rust, I wonder if we should switch the order while we still can. Version 0.3.0 is already released so it might break some people's code, but we're not yet at 1.0, so I think it might be fine.It's a trivial difference, but I fear that people might get confused with
[E, T]
when expecting an API similar to Rust and will mix up the order of the type parameters. What do you think, @tyehle?The text was updated successfully, but these errors were encountered: