StdInstances

Source
All.scala
trait TryOptics
trait PlatformSpecificStringOptics
trait MapOptics
trait IntOptics
class Object
trait Matchable
class Any
object Monocle
object all

Value members

Inherited methods

def chainToList[A]: Iso[Chain[A], List[A]]
Inherited from
ChainOptics
Source
Chain.scala
final def chainToNec[A]: Prism[Chain[A], Type[A]]
def chainToVector[A]: Iso[Chain[A], Vector[A]]
Inherited from
ChainOptics
Source
Chain.scala
final def failure[E, A]: Prism[Validated[E, A], E]
Inherited from
ValidatedOptics
Source
Validated.scala
final def flip[A, B, C]: Iso[A => B => C, B => A => C]
Inherited from
FunctionOptics
Source
Function.scala
final def flipped[A, B, C]: A => B => C => B => A => C
Inherited from
FunctionOptics
Source
Function.scala
def listToVector[A]: Iso[List[A], Vector[A]]
Inherited from
ListOptics
Source
List.scala
def mapToSet[K]: Iso[Map[K, Unit], Set[K]]
Inherited from
MapOptics
Source
Map.scala
final def necToOneAnd[A]: Iso[Type[A], OneAnd[[A] =>> Chain[A], A]]
final def nelToOneAnd[A]: Iso[NonEmptyList[A], OneAnd[List, A]]
final def nevToOneAnd[A]: Iso[NonEmptyVector[A], OneAnd[Vector, A]]
final def none[A]: Prism[Option[A], Unit]
Inherited from
OptionOptics
Source
Option.scala
final def optNecToChain[A]: Iso[Option[Type[A]], Chain[A]]
final def optNelToList[A]: Iso[Option[NonEmptyList[A]], List[A]]
final def optNevToVector[A]: Iso[Option[NonEmptyVector[A]], Vector[A]]
final def optionToDisjunction[A]: Iso[Option[A], Either[Unit, A]]
Inherited from
OptionOptics
Source
Option.scala
def pChainToList[A, B]: PIso[Chain[A], Chain[B], List[A], List[B]]
Inherited from
ChainOptics
Source
Chain.scala
final def pChainToNec[A, B]: PPrism[Chain[A], Chain[B], Type[A], Type[B]]
def pChainToVector[A, B]: PIso[Chain[A], Chain[B], Vector[A], Vector[B]]
Inherited from
ChainOptics
Source
Chain.scala
final def pFailure[E, A, F]: PPrism[Validated[E, A], Validated[F, A], E, F]
Inherited from
ValidatedOptics
Source
Validated.scala
def pListToVector[A, B]: PIso[List[A], List[B], Vector[A], Vector[B]]
Inherited from
ListOptics
Source
List.scala
final def pNecToOneAnd[A, B]: PIso[Type[A], Type[B], OneAnd[[A] =>> Chain[A], A], OneAnd[[A] =>> Chain[A], B]]
final def pNelToOneAnd[A, B]: PIso[NonEmptyList[A], NonEmptyList[B], OneAnd[List, A], OneAnd[List, B]]
final def pNevToOneAnd[A, B]: PIso[NonEmptyVector[A], NonEmptyVector[B], OneAnd[Vector, A], OneAnd[Vector, B]]
final def pOptNecToChain[A, B]: PIso[Option[Type[A]], Option[Type[B]], Chain[A], Chain[B]]
final def pOptNelToList[A, B]: PIso[Option[NonEmptyList[A]], Option[NonEmptyList[B]], List[A], List[B]]
final def pOptNevToVector[A, B]: PIso[Option[NonEmptyVector[A]], Option[NonEmptyVector[B]], Vector[A], Vector[B]]
final def pOptionToDisjunction[A, B]: PIso[Option[A], Option[B], Either[Unit, A], Either[Unit, B]]
Inherited from
OptionOptics
Source
Option.scala
final def pSome[A, B]: PPrism[Option[A], Option[B], A, B]
Inherited from
OptionOptics
Source
Option.scala
final def pStdLeft[A, B, C]: PPrism[Either[A, B], Either[C, B], A, C]
Inherited from
EitherOptics
Source
Either.scala
final def pStdRight[A, B, C]: PPrism[Either[A, B], Either[A, C], B, C]
Inherited from
EitherOptics
Source
Either.scala
final def pSuccess[E, A, B]: PPrism[Validated[E, A], Validated[E, B], A, B]
Inherited from
ValidatedOptics
Source
Validated.scala
def pTheseLeft[A, B, C]: POptional[Ior[A, B], Ior[C, B], A, C]
Inherited from
TheseOptics
Source
These.scala
def pTheseRight[A, B, C]: POptional[Ior[A, B], Ior[A, C], B, C]
Inherited from
TheseOptics
Source
These.scala
final def pTrySuccess[A, B]: PPrism[Try[A], Try[B], A, B]
Inherited from
TryOptics
Source
Try.scala
final def pValidatedToDisjunction[E1, E2, A1, A2]: PIso[Validated[E1, A1], Validated[E2, A2], Either[E1, A1], Either[E2, A2]]
Inherited from
ValidatedOptics
Source
Validated.scala
final def pVectorToNev[A, B]: PPrism[Vector[A], Vector[B], NonEmptyVector[A], NonEmptyVector[B]]
final def some[A]: Prism[Option[A], A]
Inherited from
OptionOptics
Source
Option.scala
final def stdLeft[A, B]: Prism[Either[A, B], A]
Inherited from
EitherOptics
Source
Either.scala
final def stdRight[A, B]: Prism[Either[A, B], B]
Inherited from
EitherOptics
Source
Either.scala
final def success[E, A]: Prism[Validated[E, A], A]
Inherited from
ValidatedOptics
Source
Validated.scala
def theseLeft[A, B]: Optional[Ior[A, B], A]
Inherited from
TheseOptics
Source
These.scala
def theseRight[A, B]: Optional[Ior[A, B], B]
Inherited from
TheseOptics
Source
These.scala
def theseToDisjunction[A, B]: Prism[Ior[A, B], Either[A, B]]
Inherited from
TheseOptics
Source
These.scala
final def tryFailure[A]: Prism[Try[A], Throwable]
Inherited from
TryOptics
Source
Try.scala
final def trySuccess[A]: Prism[Try[A], A]
Inherited from
TryOptics
Source
Try.scala
def tuple1Iso[A]: Iso[(A), A]
Inherited from
Tuple1Optics
Source
Tuple1.scala
final def validationToDisjunction[E, A]: Iso[Validated[E, A], Either[E, A]]
Inherited from
ValidatedOptics
Source
Validated.scala
final def vectorToNev[A]: Prism[Vector[A], NonEmptyVector[A]]
final def withDefault[A](defaultValue: A): Iso[Option[A], A]

Creates an Iso that maps None to defaultValue and inversely.

Creates an Iso that maps None to defaultValue and inversely.

val defaultTo0 = withDefault(0)
defaultTo0.get(None) == 0
defaultTo0.get(Some(1)) == 1
defaultTo0.reverseGet(0) == None
defaultTo0.reverseGet(1) == Some(1)

withDefault is a valid Iso only if we consider the set of A without defaultValue. For example, Some(0) breaks the round-trip property of Iso:

defaultTo0.reverseGet(defaultTo0.get(Some(0))) == None
See also

This method is called non in Haskell Lens.

Inherited from
OptionOptics
Source
Option.scala

Inherited fields

val bigDecimalToInt: Prism[BigDecimal, Int]
val bigDecimalToLong: Prism[BigDecimal, Long]
val bigIntToBoolean: Prism[BigInt, Boolean]
Inherited from
BigIntOptics
Source
BigInt.scala
val bigIntToByte: Prism[BigInt, Byte]
Inherited from
BigIntOptics
Source
BigInt.scala
val bigIntToChar: Prism[BigInt, Char]
Inherited from
BigIntOptics
Source
BigInt.scala
val bigIntToInt: Prism[BigInt, Int]
Inherited from
BigIntOptics
Source
BigInt.scala
val bigIntToLong: Prism[BigInt, Long]
Inherited from
BigIntOptics
Source
BigInt.scala
val byteToBoolean: Prism[Byte, Boolean]
Inherited from
ByteOptics
Source
Byte.scala
val charToBoolean: Prism[Char, Boolean]
Inherited from
CharOptics
Source
Char.scala
val doubleToFloat: Prism[Double, Float]
Inherited from
DoubleOptics
Source
Double.scala
val doubleToInt: Prism[Double, Int]
Inherited from
DoubleOptics
Source
Double.scala
val intToBoolean: Prism[Int, Boolean]
Inherited from
IntOptics
Source
Int.scala
val intToByte: Prism[Int, Byte]
Inherited from
IntOptics
Source
Int.scala
val intToChar: Prism[Int, Char]
Inherited from
IntOptics
Source
Int.scala
val longToBoolean: Prism[Long, Boolean]
Inherited from
LongOptics
Source
Long.scala
val longToByte: Prism[Long, Byte]
Inherited from
LongOptics
Source
Long.scala
val longToChar: Prism[Long, Char]
Inherited from
LongOptics
Source
Long.scala
val longToInt: Prism[Long, Int]
Inherited from
LongOptics
Source
Long.scala
val stringToBoolean: Prism[String, Boolean]
Inherited from
StringOptics
Source
String.scala
val stringToByte: Prism[String, Byte]
Inherited from
StringOptics
Source
String.scala
val stringToInt: Prism[String, Int]
Inherited from
StringOptics
Source
String.scala
val stringToList: Iso[String, List[Char]]
Inherited from
StringOptics
Source
String.scala
val stringToLong: Prism[String, Long]
Inherited from
StringOptics
Source
String.scala
val stringToURI: Prism[String, URI]
Inherited from
StringOptics
Source
String.scala
val stringToURL: Prism[String, URL]
Inherited from
PlatformSpecificStringOptics
Source
PlatformSpecificString.scala
val stringToUUID: Prism[String, UUID]
Inherited from
StringOptics
Source
String.scala