Module
Control.Comonad.Cofree
- Package
- purescript-free
- Repository
- purescript/purescript-free
The cofree comonad for a Functor.
#Cofree Source
newtype Cofree f aThe Cofree Comonad for a functor.
A value of type Cofree f a consists of an f-branching
tree, annotated with labels of type a.
The Comonad instance supports redecoration, recomputing
labels from the local context.
Instances
(Eq1 f, Eq a) => Eq (Cofree f a)(Eq1 f) => Eq1 (Cofree f)(Ord1 f, Ord a) => Ord (Cofree f a)(Ord1 f) => Ord1 (Cofree f)(Functor f) => Functor (Cofree f)(Foldable f) => Foldable (Cofree f)(Traversable f) => Traversable (Cofree f)(Functor f) => Extend (Cofree f)(Functor f) => Comonad (Cofree f)(Alternative f) => Apply (Cofree f)(Alternative f) => Applicative (Cofree f)(Alternative f) => Bind (Cofree f)(Alternative f) => Monad (Cofree f)Lazy (Cofree f a)
#deferCofree Source
deferCofree :: forall a f. (Unit -> Tuple a (f (Cofree f a))) -> Cofree f aLazily creates a value of type Cofree f a from a label and a
functor-full of "subtrees".
#unfoldCofree Source
unfoldCofree :: forall a s f. Functor f => (s -> a) -> (s -> f s) -> s -> Cofree f aThis signature is deprecated and will be replaced by buildCofree in a
future release.
#buildCofree Source
buildCofree :: forall a s f. Functor f => (s -> Tuple a (f s)) -> s -> Cofree f aRecursively unfolds a Cofree structure given a seed.
#explore Source
explore :: forall b a g f. Functor f => Functor g => (forall y x. f (x -> y) -> g x -> y) -> Free f (a -> b) -> Cofree g a -> bExplore a value in the cofree comonad by using an expression in a corresponding free monad.
The free monad should be built from a functor which pairs with the functor underlying the cofree comonad.