Control.Cofree
- Package
- purescript-concur-core
- Repository
- purescript-concur/purescript-concur-core
AJ: This is the same as Control.Comonad.Cofree
from the purescript-free
package.
However, we need to override the applicative and monad instance, and "probably" due to a Purescript bug it's not working.
The cofree comonad for a Functor
.
This version also adds lazyCofree
, lazyHead
, lazyTail
, and mfix
#Cofree Source
newtype Cofree :: (Type -> Type) -> Type -> Type
newtype Cofree f a
The 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)
(Monoid v) => ShiftMap (Widget v) (Cofree (Widget v))
#buildCofree Source
buildCofree :: forall f s a. Functor f => (s -> Tuple a (f s)) -> s -> Cofree f a
Recursively unfolds a Cofree
structure given a seed.
#lazyCofree Source
lazyCofree :: forall f a. Lazy (Tuple a (f (Cofree f a))) -> Cofree f a
Lazily creates a value of type Cofree f a
from a label and a
functor-full of "subtrees".
#deferCofree Source
deferCofree :: forall f a. (Unit -> Tuple a (f (Cofree f a))) -> Cofree f a
Lazily creates a value of type Cofree f a
from a label and a
functor-full of "subtrees".
#explore Source
explore :: forall f g a b. Functor f => Functor g => (forall x y. f (x -> y) -> g x -> y) -> Free f (a -> b) -> Cofree g a -> b
Explore 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.
#unfoldCofree Source
unfoldCofree :: forall f s a. Functor f => (s -> a) -> (s -> f s) -> s -> Cofree f a
This signature is deprecated and will be replaced by buildCofree
in a
future release.
- Modules
- Concur.
Core - Concur.
Core. DOM - Concur.
Core. DevTools - Concur.
Core. Discharge - Concur.
Core. ElementBuilder - Concur.
Core. FRP - Concur.
Core. Gen - Concur.
Core. IsWidget - Concur.
Core. LiftWidget - Concur.
Core. Patterns - Concur.
Core. Props - Concur.
Core. Types - Control.
Cofree - Control.
MonadFix - Control.
MultiAlternative - Control.
ShiftMap