Skip to main content

Option

Option

Option Constructors

Similar to Either, creating Option can expose its data instead of type.

e.g.) The following code returns Some[Int] not Option[Int].

Some(1)
// res0: Some[Int] = Some(value = 1)

Also None is None not Option[A].

None
// res1: None.type = None

With just-fp,

import just.fp.syntax._
1.some
// res2: Option[Int] = Some(value = 1)
none[String]
// res3: Option[String] = None