Relative Content

Tag Archive for either

Why are Scala’s Either and Option types not interfaces/traits but classes?

I wanted to create a class CompileResult, that can be treated like an Either type but has some additional useful methods. It should be a CompileSuccess or a CompileFailure (which, too, has some extended functionality). However I can’t do that because Either is an abstract class and I don’t want to extend it but rather use delegation and have an Either stored internally.