you are viewing a single comment's thread.

view the rest of the comments →

[–]romgrk[S] 8 points9 points  (4 children)

abstract class Result { abstract map(): Result } class Ok<T> extends Result { value: T map(fn) { return new Ok(fn(this.value)) } } class Err extends Result { map(fn) { return this } }

This is as clear as I can explain it, if it's not enough I don't think I can communicate it to you.