News for hackers. Stuff that matters.
Re:From First Principles: Why Scala? by Fellshard on Thursday February 11, 2021 @02:04PM (#26105714)
I've been working through 'Haskell From First Principles', and it turned on a lightbulb: the 'right' half of Either is the 'important' one because its type variable is free to change.

  instance Functor (Either a) where    -- a is fixed here!
    fmap :: (b -> c) -> Either a b -> Either a c
    fmap _ (Left l)  = Left l
    fmap f (Right r) = Right (f r)
As a general rule, the last type parameter of a type carries special significance: the same applies to Tuples.

You _can_ trivially construct a type where the two labels are swapped; it's just labels, Left and Right aren't intrinsically important, except insofar as they reflect the positions of the type arguments in written text.

  data Either' a b = Left b | Right a
Re:From First Principles: Why Scala? by yw3410 on Thursday February 11, 2021 @04:16PM (#26107323)
This is also the reason we have the convention in Scala as well - the inference to partially apply the type works in a certain way. But I agree with the parent post, a more descriptive name would be better.
Re:From First Principles: Why Scala? by tomp on Saturday February 13, 2021 @06:44AM (#26123030)
The obvious (and obviousyl better/correct) name for that type is Result; instead, Either should be unbiased.
Re:From First Principles: Why Scala? by Fellshard on Thursday February 11, 2021 @06:44PM (#26109076)
Right; ostensibly you could create a language that lets you easily poke holes in any slot of a type, but I'm not sure you necessarily /gain/ a lot in doing so except for confusion. It would take a lot more convolution to specify types and instances for every function application.