4 ms·
FYI your Scala example doesn't work. Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). scala> var h:Option[String] =
by desdiv 11y ago
FYI your Scala example doesn't work.
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
scala> var h:Option[String] = "Hello".some
<console>:7: error: value some is not a member of String
var h:Option[String] = "Hello".some
- andrioni 11y agoThe author is using the scalaz syntax, you could substitute it for the "vanilla" syntax: var h: Option[String] = Option("Hello") or import scalaz (in case you have it in your classpath etc): import scalaz._, Scalaz._ var h: Option[String] = "Hello".some
- _Codemonkeyism 11y agoSorry, as the other comment mentioned this is Scalaz as it makes code IMHO a little more readable. The example was more about the h:Option[String] part.