-
Wrapped
Maybe
value.Declaration
Swift
public let value: Maybe<A>
-
Safe downcast.
Declaration
Swift
public static func fix(_ value: MaybeKOf<A>) -> MaybeK<A>
Parameters
value
Value in the higher-kind form.
Return Value
Value cast to MaybeK.
-
Provides an empty
MaybeK
.Declaration
Swift
public static func empty() -> MaybeK<A>
Return Value
A
MaybeK
that does not provide any value. -
Creates a
MaybeK
from the result of evaluating a function, suspending its execution.Declaration
Swift
public static func from(_ f: @escaping () throws -> A) -> MaybeK<A>
Parameters
f
Function providing the value to be provided in the underlying
Maybe
.Return Value
A
MaybeK
that provides the value obtained from the closure. -
Creates a
MaybeK
from the result of evaluating a function, suspending its execution.Declaration
Swift
public static func invoke(_ f: @escaping () throws -> MaybeKOf<A>) -> MaybeK<A>
Parameters
f
Function providing the value to be provided by the underlying
Maybe
.Return Value
A
MaybeK
that provides the value obtained from the closure. -
Initializes a value of this type with the underlying
Maybe
value.Declaration
Swift
public init(_ value: Maybe<A>)
Parameters
value
Wrapped
Maybe
value. -
Performs an action based on the result of the execution of the underlying
Maybe
.Declaration
Swift
public func fold<B>(_ ifEmpty: @escaping () -> B, _ ifSome: @escaping (A) -> B) -> B
Parameters
ifEmpty
Action to be performed if the underlying
Maybe
is empty.ifSome
Action to be perfomed if the underlying
Maybe
has a value.Return Value
Result of performing either operation.