all
- Source
- All.scala
trait StdInstances
trait ValidatedOptics
trait NonEmptyVectorOptics
trait NonEmptyListOptics
trait NonEmptyChainOptics
trait TheseOptics
trait ChainOptics
trait TryOptics
trait Tuple1Optics
trait StringOptics
trait PlatformSpecificStringOptics
trait OptionOptics
trait MapOptics
trait LongOptics
trait ListOptics
trait IntOptics
trait FunctionOptics
trait EitherOptics
trait DoubleOptics
trait CharOptics
trait ByteOptics
trait BigIntOptics
trait BigDecimalOptics
class Object
trait Matchable
class Any
Value members
Inherited methods
final def pNecToOneAnd[A, B]: PIso[Type[A], Type[B], OneAnd[[A] =>> Chain[A], A], OneAnd[[A] =>> Chain[A], B]]
- Inherited from
- NonEmptyChainOptics
- Source
- NonEmptyChain.scala
final def pNelToOneAnd[A, B]: PIso[NonEmptyList[A], NonEmptyList[B], OneAnd[List, A], OneAnd[List, B]]
- Inherited from
- NonEmptyListOptics
- Source
- NonEmptyList.scala
final def pNevToOneAnd[A, B]: PIso[NonEmptyVector[A], NonEmptyVector[B], OneAnd[Vector, A], OneAnd[Vector, B]]
- Inherited from
- NonEmptyVectorOptics
- Source
- NonEmptyVector.scala
final def pOptNelToList[A, B]: PIso[Option[NonEmptyList[A]], Option[NonEmptyList[B]], List[A], List[B]]
- Inherited from
- NonEmptyListOptics
- Source
- NonEmptyList.scala
final def pOptNevToVector[A, B]: PIso[Option[NonEmptyVector[A]], Option[NonEmptyVector[B]], Vector[A], Vector[B]]
- Inherited from
- NonEmptyVectorOptics
- Source
- NonEmptyVector.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
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