-
First value wrapped in this comonad.
Declaration
Swift
public let head: A
-
Safe downcast.
Declaration
Swift
public static func fix(_ fa: CofreeOf<F, A>) -> Cofree<F, A>
Parameters
fa
Value in the higher-kind form.
Return Value
Value cast to Cofree.
-
Obtains the values in the context of this Cofree comonad.
Declaration
Swift
public func tailForced() -> Kind<F, Cofree<F, A>>
Return Value
The result of evaluating the tail of this Cofree.
-
Constructs a Cofree from a seed and an unfolding function.
Declaration
Swift
public static func unfold( _ a: A, _ f: @escaping (A) -> Kind<F, A> ) -> Cofree<F, A>
Parameters
a
Seed.
f
Unfolding function.
Return Value
A Cofree value resulting from the unfolding process.
-
Constructs a Cofree from a seed and an unfolding function.
Declaration
Swift
public static func create( _ a: A, _ f: @escaping (A) -> Kind<F, A> ) -> Cofree<F, A>
Parameters
a
Seed.
f
Unfolding function.
Return Value
A Cofree value resulting from the unfolding process.
-
Folds this structure into a monadic value.
Declaration
Parameters
folder
Folding function to collaps this structure.
inclusion
A natural transformation into the target Monad.
Return Value
A value in the new monadic context.