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

scala.Either #753

Closed
scabug opened this issue Apr 16, 2008 · 3 comments
Closed

scala.Either #753

scabug opened this issue Apr 16, 2008 · 3 comments

Comments

@scabug
Copy link

scabug commented Apr 16, 2008

The scala.Either (disjoint union) type after discussions and reviews with the Scala development team.

@scabug
Copy link
Author

scabug commented Apr 16, 2008

Imported From: https://issues.scala-lang.org/browse/SI-753?orig=1
Reporter: @tonymorris
Attachments:

  • Either.patch (created on Apr 16, 2008 2:01:46 AM UTC, 25275 bytes)

@scabug
Copy link
Author

scabug commented Apr 18, 2008

Geoffrey Alan Washburn (washburn) said:
Okay, I've applied the patch, but made the following changes:

  • I don't really see any reason for Left/RightProjection to have an "either" field
    given that they are both case classes, so the argument "e" is available as a
    field, and the Either trait has a method "either" which may prove confusing.
  • However, I've renamed the "either" method to "fold", because that is what it
    is, and to be more consistent with the rest of the standard library.
  • I removed "valueE" from the projections, and renamed "value" to be "get" to be
    more symmetric with Option. Like Option, it throws
    Predef.NoSuchElementException in the error case.
  • I've renamed the "seq" and "option" methods of the projections to "toSeq" and
    "toOption" to be more consistent with existing library code.
  • I've removed "left" and "right" from the Either object as I cannot determine how
    they would be more useful than using the case class constructors directly.
  • I've removed "on" and "ap" from the projections because their meaning is very
    non-obvious and I see no precedent for such functions (for example, functions
    with the same name in Hoogle are completely unrelated)
  • I've renamed "reduce" in the Either object to "merge" to avoid confusion with
    uses of "reduce" elsewhere in the library, however I am still not happy with this
    name.
  • I've eliminated "throws" and "throwsIt" from the Either object because they
    seem arbitrarily asymmetric.
  • I've renamed "iif" in the Either object to "cond".
  • I've moved "leftsRights" to the List object and renamed it "separate". Alas,
    I could not rename it "unzip" due to erasure restrictions.
  • I've moved "lefts" and "rights" to the List object.

We can still tweak some of these things before 2.7.1 finally if they are truly important.

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone next_bugfix deleted

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

No branches or pull requests

1 participant