option
monocle.std.option$
Attributes
- Source:
- Option.scala
- Graph
- Supertypes
- Self type
- option.type
Members list
Concise view
Value members
Inherited methods
Attributes
- Inherited from:
- OptionOptics
- Source:
- Option.scala
Attributes
- Inherited from:
- OptionOptics
- Source:
- Option.scala
Attributes
- Inherited from:
- OptionOptics
- Source:
- Option.scala
Attributes
- Inherited from:
- OptionOptics
- Source:
- Option.scala
Attributes
- Inherited from:
- OptionOptics
- Source:
- Option.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
Attributes
- See also:
This method is called
non
in Haskell Lens.- Inherited from:
- OptionOptics
- Source:
- Option.scala