CoT
CoT gives you the best
pairing monad transformer for any Comonad W
In other words, an explorer for the state space given by W. It can also provide:
- A MonadReader from a ComonadEnv
- A MonadWriter from a ComonadTraced
- A MonadState from a ComonadStore
-
Safe downcast.
Declaration
Swift
public static func fix(_ value: CoTOf<W, M, A>) -> CoT<W, M, A>
Parameters
value
Value in the higher-kind form.
Return Value
Value cast to CoT.
-
Lifts a comonadic query into a CoT.
The original signature of this function is:
(forall s. w s -> a) -> CoT w m a
Declaration
Swift
public static func liftT(_ f: @escaping (Kind<W, Any/*S*/>) -> A) -> CoT<W, M, A>
Parameters
f
Comonadic query.
Return Value
A CoT from the Comonadic query.
-
Explores the space of a Comonad with a given Monad.
Parameters
co
Monadic actions to explore the Comonad.
wa
Comonadic space to explore.
Return Value
A new Comonadic space resulting from the exploration.
-
Runs the inner function.
Declaration
Swift
func run<R>(_ w: Kind<W, (A) -> R>) -> R
Parameters
w
Argument for the inner function.
Return Value
A plain value.
-
Runs the inner function with a value that does not runs on the base Monad.
Declaration
Swift
func lower<B>(_ input: Kind<W, B>) -> A
Parameters
input
A value in the Comonad context.
Return Value
A plain value.