Welcome to Scala version 2.10.1 (OpenJDK 64-Bit Server VM, Java 1.6.0_27). Type in expressions to have them evaluated. Type :help for more information. scala> def o1: Option[Option[Unit]] = Some(()).map(Some(_)) o1: Option[Option[Unit]] scala> o1 res0: Option[Option[Unit]] = Some(Some(()))
So far, everything is as expected. But what if we forget to indicate that we have an Option nested in Option ?
scala> def o2: Option[Unit] = Some(()).map(Some(_)) o2: Option[Unit] scala> o2 res1: Option[Unit] = Some(())
Why does the compiler accept this and implicitly align the value?
source share