Just to add to what others have already said...
Option
should be used anywhere that a cell logically may or may not have a value. As Stephen pointed out, the complexity can easily be mitigated by defining the Map
and Lift
functions for Cell[Option[A]]
.
In C# this can be done via extension methods...
public static Cell<Maybe<TResult>> Map<T, TResult>(
this Cell<Maybe<T>> cell,
Func<T, TResult> f) =>
cell.Map(m => m.Map(f));
I believe implicit classes can be used in Scala to achieve the same thing (please forgive my possibly incorrect Scala syntax)...
implicit class OptionCell[A](val cell: Cell[Option[A]]) extends AnyVal {
def map[B](f: A => B) = ... // return Cell[Option[B]]
}