Option
case Nonecase Some(t)Type of optional values.
The constructor None represents an absent value,
whereas the constructor Some(v) represents the value v.
Type of optional values, and its functions.
Instances
instance Applicative[Option]Sourceinstance CommutativeMonoid[Option[a]] with CommutativeMonoid[a]Sourceinstance CommutativeSemiGroup[Option[a]] with CommutativeSemiGroup[a]Sourceinstance Filterable[Option]Sourceinstance Formattable[Option[a]] with Formattable[a]Sourcetype Aef = Aef[a]JNull decodes to None; any other value is decoded with FromJson[a]
and wrapped in Some. The path is left unchanged — Option does not
introduce a structural step.
instance JoinLattice[Option[t]] with JoinLattice[t]Sourceinstance LowerBound[Option[t]]Sourceinstance MeetLattice[Option[t]] with MeetLattice[t]Sourceinstance PartialOrder[Option[t]] with PartialOrder[t]Sourceinstance Traversable[Option]Sourceinstance UnorderedFoldable[Option]Sourceinstance Witherable[Option]SourceDefinitions
If both arguments are Some, return a Some containing the result of applying the function inside
f to the value inside x. Otherwise return None.
Returns 1 if o is Some(v) and the predicate f(v) evaluates to true. Otherwise returns 0.
Returns true if o is Some(v) and the predicate f(v) evaluates to true. Otherwise returns false.
Returns o if o is Some(v) and the predicate f(v) is true. Otherwise returns None.
Returns o if o is Some(v) and the predicate f(v) evaluates to true. Otherwise returns None.
The function f must be pure.
Returns f(v) if o is Some(v). Otherwise returns None.
Returns v if o is Some(v). Otherwise returns None.
Returns the result of applying combine to all the elements in o, using empty as the initial value.
Returns f(z, v) if o is Some(v). Otherwise returns z.
Returns the result of applying f to a start value s and the elements in l
going from left to right.
If at any step applying f fails (i.e. it produces a None value) the traversal
of l is short-circuited and None is returned.
If f is successfully applied to all the elements in l the result is of the form:
Some(f(...f(f(s, x1), x2)..., xn)).
Returns the result of mapping each element and combining the results.
Returns f(v, z) if o is Some(v). Otherwise returns z.
Returns the result of applying f to a start value s and the elements in l
going from right to left.
If at any step applying f fails (i.e. it produces a None value) the traversal
of l is short-circuited and None is returned.
If f is successfully applied to all elements in l the result is of the form:
Some(f(x1, ...f(xn-1, f(xn, s))...)).
Returns true if o is Some(v) and the predicate f(v) evaluates to true or if o is None.
Otherwise returns false.
Applies f to v if o is Some(v). Otherwise does nothing.
Returns v if o is Some(v). Otherwise aborts with a stack trace.
Returns an iterator over o with 1 element or an empty iterator if o is None.
Returns Some(f(v)) if o is Some(v). Otherwise returns None.
def map10(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> (t8 -> (t9 -> (t10 -> u \ ef))))))))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4], o5: Option[t5], o6: Option[t6], o7: Option[t7], o8: Option[t8], o9: Option[t9], o10: Option[t10]): Option[u] \ ef§ SourceApplies the 10-ary function f to the values in o1, o2, ... o10.
Returns None if any of o1, o2, ... o10 are None.
Applies the binary function f to the values in o1 and o2.
Returns None if either o1 or o2 are None.
def map3(f: t1 -> (t2 -> (t3 -> u \ ef)), o1: Option[t1], o2: Option[t2], o3: Option[t3]): Option[u] \ ef§ SourceApplies the ternary function f to the values in o1, o2 and o3.
Returns None if any of o1, o2 and o3 are None.
def map4(f: t1 -> (t2 -> (t3 -> (t4 -> u \ ef))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4]): Option[u] \ ef§ SourceApplies the 4-ary function f to the values in o1, o2, o3 and o4.
Returns None if any of o1, o2, o3 and o4 are None.
def map5(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> u \ ef)))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4], o5: Option[t5]): Option[u] \ ef§ SourceApplies the 5-ary function f to the values in o1, o2, ... o5.
Returns None if any of o1, o2, ... o5 are None.
def map6(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> u \ ef))))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4], o5: Option[t5], o6: Option[t6]): Option[u] \ ef§ SourceApplies the 6-ary function f to the values in o1, o2, ... o6.
Returns None if any of o1, o2, ... o6 are None.
def map7(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> u \ ef)))))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4], o5: Option[t5], o6: Option[t6], o7: Option[t7]): Option[u] \ ef§ SourceApplies the 7-ary function f to the values in o1, o2, ... o7.
Returns None if any of o1, o2, ... o7 are None.
def map8(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> (t8 -> u \ ef))))))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4], o5: Option[t5], o6: Option[t6], o7: Option[t7], o8: Option[t8]): Option[u] \ ef§ SourceApplies the 8-ary function f to the values in o1, o2, ... o8.
Returns None if any of o1, o2, ... o8 are None.
def map9(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> (t8 -> (t9 -> u \ ef)))))))), o1: Option[t1], o2: Option[t2], o3: Option[t3], o4: Option[t4], o5: Option[t5], o6: Option[t6], o7: Option[t7], o8: Option[t8], o9: Option[t9]): Option[u] \ ef§ SourceApplies the 9-ary function f to the values in o1, o2, ... o9.
Returns None if any of o1, o2, ... o9 are None.
Returns Some(dst) if o is Some(src). Otherwise returns o.
Returns Some(v1 :: v2 :: ... :: vn) if each of xs_i is Some(v_i). Otherwise returns None.
Returns f(v) if o is Some(v) else 0.
Returns the Option value Err(e) if o is Some(e). Otherwise returns Ok(d).
Returns e into Validation's Failure if o is Some(e). Otherwise returns Success(d).
Returns a one-element list of the value v if o is Some(v). Otherwise returns the empty list.
Returns a singleton map with the mapping k -> v if o is Some((k, v)). Otherwise returns the empty map.
Returns a map with elements of s as keys and f applied as values.
Returns the Option value Ok(v) if o is Some(v). Otherwise returns Err(e).
Returns a one-element set of the value v if o is Some(v). Otherwise returns the empty set.
Returns the Validation value Success(v) if o is Some(v). Otherwise lifts e into Validation's Failure.
Returns Some(v1 :: v2 :: ... v :: vn) if each of f(l_i) is Some(v_i). Otherwise returns None.
Returns Some() if each of f(l_i) is Some(_). Otherwise returns None.
This function is the "forgetful" version of traverse, use it when you want the effect
of applying f to each element but do not care about collecting the results.
Returns (Some(v1), Some(v2)) if o is Some((v1, v2)). Otherwise returns (None, None).
Returns o if it is Some(v). Otherwise returns default.