Optionally

name.rayrobdod.stringContextParserCombinator.typeclass.Optionally
See theOptionally companion trait
object Optionally

Predefined implicit implementations of Optionally and methods to create new Optionally

Attributes

Companion
trait
Source
Optionally.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Optionally.type

Members list

Value members

Concrete methods

def apply[A, Z](noneFn: => Z, someFn: A => Z): Optionally[A, Z]

Constructs an Optionally from a set of functions corresponding to each of Optionally's methods

Constructs an Optionally from a set of functions corresponding to each of Optionally's methods

Attributes

Source
Optionally.scala
def whereDefault[A](default: => A): Optionally[A, A]

An Optionally in which a present value is used as-is, and default is used if the value is missing

An Optionally in which a present value is used as-is, and default is used if the value is missing

Attributes

Example
import name.rayrobdod.stringContextParserCombinator.Interpolator.idInterpolators
given Optionally[Char, Char] = Optionally.whereDefault('A')
val p = idInterpolators.charIn('0' to '9').optionally()
p.interpolate(StringContext("5"), Nil) // '5': Char
p.interpolate(StringContext(""), Nil) // 'A': Char
Source
Optionally.scala

Implicits

Implicits

implicit def unit: Optionally[Unit, Unit]

The Unit-handling Optionally; the result is a Unit whether the value is present or not

The Unit-handling Optionally; the result is a Unit whether the value is present or not

import name.rayrobdod.stringContextParserCombinator.Interpolator.Interpolator
val p1:Interpolator[Unit] = ???

((p1:Interpolator[Unit]).optionally()):Interpolator[Unit]

Attributes

Source
Optionally.scala

Inherited implicits

implicit def toOption[A]: Optionally[A, Option[A]]

The fallback Optionally; wraps a present value in a Some, and uses None as the missing value

The fallback Optionally; wraps a present value in a Some, and uses None as the missing value

import name.rayrobdod.stringContextParserCombinator.Interpolator.Interpolator
class A {}
val p1:Interpolator[A] = ???

((p1:Interpolator[A]).optionally()):Interpolator[Option[A]]

Attributes

Inherited from:
LowPrioOptionally (hidden)
Source
Optionally.scala