A type to describe a possibly absent val.
More...
|
T | GetOrElse (T other) |
| Get the stored val or the given default instead. More...
|
|
Maybe< TResult > | Select< TResult > ([NotNull] Func< T, TResult > fn) |
| Map the function fn over the wrapped val if present. Wrap the result in as well. More...
|
|
Maybe< T > | Select_ ([NotNull] Action< T > fn) |
| Map the function fn over the wrapped val if present; discard the result. More...
|
|
Maybe< TResult > | SelectMany< TResult > ([NotNull] Func< T, Maybe< TResult >> fn) |
| Map the function fn over the wrapped val if present. More...
|
|
Maybe< TResult > | SelectMany< TInter, TResult > ([NotNull] Func< T, Maybe< TInter >> firstFn, [NotNull] Func< T, TInter, TResult > secondFn) |
| Map the first function over the wrapped value and the second function over the result. If the wrapped value isn't present or the first or second functions return no value, Nothing is returned. This variant of SelectMany enables LINQ's syntactic sugar. More...
|
|
Maybe< T > | Otherwise_ ([NotNull] Action fn) |
| Call the given function, if no val is present. More...
|
|
TResult | Match< TResult > ([NotNull] Func< TResult > nothing, [NotNull] Func< T, TResult > just) |
| Map either the function just over the present val or call nothing. More...
|
|
Maybe< T > | Match_ ([NotNull] Action nothing, [NotNull] Action< T > just) |
| Map either the function just over the present val or call nothing. Ignore the result. More...
|
|
override string | ToString () |
|
A type to describe a possibly absent val.
- Template Parameters
-
T | The type of the wrapped val. |
Definition at line 100 of file Maybe.cs.
T FxSharp.Maybe< T >.GetOrElse |
( |
T |
other | ) |
|
Get the stored val or the given default instead.
- Parameters
-
other | The default val to return in case no val is stored. |
- Returns
- Stored or given default val.
var name = TelephoneDirectory
.LookUpName("+49394965006")
Definition at line 136 of file Maybe.cs.
TResult FxSharp.Maybe< T >.Match< TResult > |
( |
[NotNull] Func< TResult > |
nothing, |
|
|
[NotNull] Func< T, TResult > |
just |
|
) |
| |
Map either the function just over the present val or call nothing.
- Template Parameters
-
TResult | The result type of nothing and just. |
- Parameters
-
nothing | The function to call if no val is present. |
just | The function to call with a present val. |
- Returns
- The result of the either nothing or just functions.
var name = TelephoneDirectory
.LookUpName("+49394965006")
.Match(
just: name => name.ToUpper(),
nothing: () => "John Doe");
Definition at line 265 of file Maybe.cs.
Maybe<T> FxSharp.Maybe< T >.Match_ |
( |
[NotNull] Action |
nothing, |
|
|
[NotNull] Action< T > |
just |
|
) |
| |
Map either the function just over the present val or call nothing. Ignore the result.
- Parameters
-
nothing | The function to call if no val is present. |
just | The function to call with a present val. |
TelephoneDirectory
.LookUpName("+49394965006")
just: name => view.DisplayName(name.ToUpper()),
nothing: () => view.DisplayName("Unknown caller"));
Definition at line 287 of file Maybe.cs.
Maybe<T> FxSharp.Maybe< T >.Otherwise_ |
( |
[NotNull] Action |
fn | ) |
|
Call the given function, if no val is present.
- Parameters
-
fn | A function to call if no val is present. |
- Returns
- This instance.
TelephoneDirectory
.LookUpName("+49394965006")
.
Otherwise_(() => view.DisplayName(
"Unknown caller"));
Definition at line 238 of file Maybe.cs.
Maybe<TResult> FxSharp.Maybe< T >.Select< TResult > |
( |
[NotNull] Func< T, TResult > |
fn | ) |
|
Map the function fn over the wrapped val if present. Wrap the result in as well.
- Template Parameters
-
TResult | The type of the result of fn. |
- Parameters
-
fn | A function to apply the the wrapped val. |
- Returns
- The wrapped mapped val.
var name = TelephoneDirectory
.LookUpName("+49394965006")
.Select(name => name.ToUpper());
Definition at line 155 of file Maybe.cs.
Maybe<T> FxSharp.Maybe< T >.Select_ |
( |
[NotNull] Action< T > |
fn | ) |
|
Map the function fn over the wrapped val if present; discard the result.
- Parameters
-
fn | A function to apply to the wrapped val. |
- Returns
- This.
TelephoneDirectory
.LookUpName("+49394965006")
.
Select_(name => view.DisplayName(name.ToUpper()));
Definition at line 175 of file Maybe.cs.
Maybe<TResult> FxSharp.Maybe< T >.SelectMany< TInter, TResult > |
( |
[NotNull] Func< T, Maybe< TInter >> |
firstFn, |
|
|
[NotNull] Func< T, TInter, TResult > |
secondFn |
|
) |
| |
Map the first function over the wrapped value and the second function over the result. If the wrapped value isn't present or the first or second functions return no value, Nothing is returned. This variant of SelectMany enables LINQ's syntactic sugar.
- Template Parameters
-
TInter | The result tpye of the first function. |
TResult | The result type of the second function. |
- Parameters
-
firstFn | The first function to apply. |
secondFn | The second function to apply. |
- Returns
- The result of the functions combined.
var caller = from name in TelephoneDirectory.LookUpName("+49394965006")
from photo in SocialNetwork.LookUpPhoto(name)
select new Caller(name, photo);
Definition at line 218 of file Maybe.cs.
Maybe<TResult> FxSharp.Maybe< T >.SelectMany< TResult > |
( |
[NotNull] Func< T, Maybe< TResult >> |
fn | ) |
|
Map the function fn over the wrapped val if present.
- Template Parameters
-
TResult | The type of the result of fn. |
- Parameters
-
fn | A function to apply the the wrapped val which wraps the result in a Maybe. |
- Returns
- The result of fn.
Definition at line 194 of file Maybe.cs.
override string FxSharp.Maybe< T >.ToString |
( |
| ) |
|
The documentation for this struct was generated from the following file: