Re:PullRequest pulls in $8M Series A just months after scori...
by Nullabillity on Sunday April 15, 2018 @04:47PM
(#16844863)
And yet, `match` is the only one that gets correct type inference.
`.map(ifSome).getOrElse(ifNone)` infers the type from `ifSome`, and forces `ifNone` to conform.
`.fold(ifNone)(ifSome)` infers the type from `ifNone`, and forces `ifSome` to conform.
Meanwhile, `match { case Some(x) => ifSome(x); case None(x) => ifNone }` will correctly infer from both cases at once, and give you the greatest common ancestor.
`.map(ifSome).getOrElse(ifNone)` infers the type from `ifSome`, and forces `ifNone` to conform.
`.fold(ifNone)(ifSome)` infers the type from `ifNone`, and forces `ifSome` to conform.
Meanwhile, `match { case Some(x) => ifSome(x); case None(x) => ifNone }` will correctly infer from both cases at once, and give you the greatest common ancestor.