HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefree-5.2Haskell2010

Control.Comonad.Trans.Cofree

The cofree comonad transformer

  • 3 types
  • 1 class
  • 6 values
  • Packagefree-5.2
  • Exports10
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCofree.hs
newtypenewtype CofreeT (f :: Type -> Type) (w :: Type -> Type) a
#

This is a cofree comonad of some functor f, with a comonad w threaded through it at each level.

Constructors

Instances17ComonadEnv, ComonadCofree, MonadTrans, ComonadTrans, ComonadHoist, Monad, …
valuerunCofree :: Cofree f a -> CofreeF f a (Cofree f a)
#

Unpeel the first layer off a cofree comonad value.

runCofree is a right inverse of cofree.

cofree . runCofree == id
datadata CofreeF (f :: Type -> Type) a b
#

This is the base functor of the cofree comonad transformer.

Constructors

  • a :< f binfixr 5
Instances23Generic1, Bifoldable, Bifunctor, Bitraversable, Eq2, Ord2, …
classclass (Functor f, Comonad w) => ComonadCofree (f :: Type -> Type) (w :: Type -> Type) | w -> f where
#

Allows you to peel a layer off a cofree comonad.

Methods

  • unwrap :: w a -> f (w a)

    Remove a layer.

Instances10ComonadCofree, …
valueheadF :: CofreeF f a b -> a
#

Extract the head of the base functor

valuetailF :: CofreeF f a b -> f b
#

Extract the tails of the base functor

valuecoiterT
  1. :: (Functor f, Comonad w)
  2. => w a -> f (w a)
  3. -> w a
  4. -> CofreeT f w a
#

Unfold a CofreeT comonad transformer from a coalgebra and an initial comonad.