On Tuesday, May 15, 2012 at 1:40 PM, Jonas Bonér wrote:
On Tue, May 15, 2012 at 11:15 AM, Kevin Wright <kev.lee...@gmail.com> wrote:I'm with √iktor and Heiko.Right-bias Either.+1 - better to fix problems rather than adding a level of indirection to work around itKeep the explicit right-projection as well, for backward-compatibility. Then either deprecate it, or (if demand for a symmetric union is high enough) migrate it to a trait so that it only needs to be mixed-in on demand.--On 15 May 2012 10:06, Heiko Seeberger <heiko.s...@googlemail.com> wrote:Why not simply right bias Either?
Heiko
On May 15, 2012, at 7:30 AM, Heather Miller wrote:
> Hi all,
>
> We introduced `Try` a while back along with SIP-14 (Futures). `Try` is analogous to `Either` with the exception that it's success-biased. That is, Either is symmetric, it has two type parameters that are wrapped (symmetrically) in either `Left` or `Right`. In general, by convention, `Either` can be used to represent a "successful" or a "failed" result, by representing some generic type in its right projection, and a subtype of Throwable in its left projection. However, this is by convention only, one can of course swap these projections (whether accidentally or purposefully) or one can represent two successful values in each projection if they so desire.
>
> `Try`, on the other hand, is parameterized only on one type, with this success/failure use case in mind. That is, the successful case is wrapped in `Success` (parameterized on T) while the failed case is a `Throwable` wrapped in `Failure`.
>
> `Try` comes from Twitter, who use it frequently in their codebase (see twitter/util on github), and who have found that it results in more readable and less error-prone code for this success/failure use case of `Either`.
>
> Back then, we tentatively decided that it would go in package scala.util.
>
> However, this is a bit awkward because, as an analogue to `Either` (which lives in package scala and needs no import) `Try` lives in scala.util and requires the following import:
>
> import scala.util.{Try, Success, Failure}
>
> So- the question is, are people happy with it this way? There was all kinds of talk-- eventually moving `Either` to the same package/sub-package as `Try`, for example.
>
> Cheers,
> Heather
>
> --
> Heather Miller
> Doctoral Assistant
> EPFL, IC, LAMP
> http://people.epfl.ch/heather.miller
>
Kevin Wright
mail: kevin....@scalatechnology.com
gtalk / msn : kev.lee...@gmail.comvibe / skype: kev.lee.wrightsteam: kev_lee_wright"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra
--
Jonas Bonér
CTO
Typesafe - The software stack for applications that scale
Phone: +46 733 777 123
Twitter: @jboner