TeSSLa: TeSSLa Standard Library for TeSSLa 2.0.0

module Option

ANCHOR Type Option

Option[T]

Represents optional values. Instances of Option are either an instance of Some or None

ANCHOR getSome

liftable getSome[T](opt: strict Option[T]): T

Get the value contained in a Some. If the given option is a None, a run-time error will occur

liftable def getSome[T](opt: strict Option[T]): T = extern("getSome")

ANCHOR getSomeOrElse

liftable getSomeOrElse[T](opt: Option[T], value: T): T

Get the value contained in a Some. If the given option is a None, the default value value will be returned

liftable def getSomeOrElse[T](opt: Option[T], value: T): T = if isSome(opt) then getSome(opt) else value

ANCHOR isNone

liftable isNone[T](opt: strict Option[T]): Bool

Returns true if the given option is a None or false if it is a Some

liftable def isNone[T](opt: strict Option[T]): Bool = extern("isNone")

ANCHOR isSome

liftable isSome[T](opt: Option[T]): Bool

Returns true if the given option is a Some or false if it is a None

liftable def isSome[T](opt: Option[T]): Bool = !isNone(opt)

ANCHOR None

None[T]: Option[T]

Represents non-existent values of type T

def None[T]: Option[T] = extern("None")

ANCHOR Some

liftable Some[T](value: lazy T): Option[T]

Represents existing values of type T

liftable def Some[T](value: lazy T): Option[T] = extern("Some")