Continuation
public struct Continuation<R, A>
Monadic implementation of continuation passing style (CPS).
An instance of Continuation<R, A>
represents a computation resulting in an A
value.
By passing a continuation of type A -> R
, a Continuation<R, A>
will use
the A
result and the continuation to produce an R
.
-
Undocumented
Declaration
Swift
public struct Continuation<R, A>
-
Undocumented
Declaration
Swift
public struct Continuation<R, A>
-
Declaration
Swift
public func map<B>(f: A -> B) -> Continuation<R, B>
Parameters
f
A function to apply to the result of this computation.
Return Value
A computation whose result is a mapping of this computation’s result.
-
Declaration
Swift
public func apply<B>(f: Continuation<R, A -> B>) -> Continuation<R, B>
Parameters
f
A computation whose result is a function to apply to this computation.
Return Value
A computation whose result is a mapping of this computation’s result.
-
Monadic
return
.Declaration
Swift
public static func of(a: A) -> Continuation<R, A>
Parameters
a
A value to wrap in
Continuation<R, A>
.Return Value
A computation that will always yield
a
. -
Monadic
bind
.Declaration
Swift
public func flatMap<B>(f: A -> Continuation<R, B>) -> Continuation<R, B>
Parameters
f
A function to apply to the result of this computation.
Return Value
A computation whose result is based on a mapping of this computation’s result.