This call maps given monadic value to the given function.
var m = 5.ToM(); var n = m.Map(x => x * 2.0); --> output: n is double and equals to 10.0
Or even maps to the number of functions.
var m = 5.ToM(); var n = m.Map(x => x * 2, x => x + 2); --> output: n is integer and equals to 12
Unwraps all nested monadic values and extracts the plain value.
var wrappedValue = new TrackValue<int>(10).ToMaybe().ToM(); var result = wrappedValue.UnwrapAll<int>();
The function throws an InvalidCastException if it fails to find the valid package of the monadic values.
InvalidCastException
var wrappedValue = "hello"; var result = wrappedValue.UnwrapAll<int>(); // <-- will throw an exception
There was an error while loading. Please reload this page.