free-5.2: Monads for free

Copyright | (C) 2008-2013 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | MPTCs, fundeps
Safe Haskell | Safe
Language | Haskell2010

Control.Comonad.Trans.Cofree

Description

The cofree comonad transformer

Synopsis

- newtype CofreeT (f :: Type -> Type) (w :: Type -> Type) a = CofreeT {
  - runCofreeT :: w (CofreeF f a (CofreeT f w a))
  }
- type Cofree (f :: Type -> Type) = CofreeT f Identity
- cofree :: forall (f :: Type -> Type) a. CofreeF f a (Cofree f a) -> Cofree f a
- runCofree :: forall (f :: Type -> Type) a. Cofree f a -> CofreeF f a (Cofree f a)
- data CofreeF (f :: Type -> Type) a b = a :< (f b)
- class (Functor f, Comonad w) => ComonadCofree (f :: Type -> Type) (w :: Type -> Type) | w -> f where
  - unwrap :: w a -> f (w a)
- headF :: forall (f :: Type -> Type) a b. CofreeF f a b -> a
- tailF :: CofreeF f a b -> f b
- transCofreeT :: forall g (w :: Type -> Type) f a. (Functor g, Comonad w) => (forall x. f x -> g x) -> CofreeT f w a -> CofreeT g w a
- coiterT :: (Functor f, Comonad w) => (w a -> f (w a)) -> w a -> CofreeT f w a

# Documentation

newtype 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

CofreeT |
Fields runCofreeT :: w (CofreeF f a (CofreeT f w a))

#### Instances

Instances details

(Functor f, ComonadEnv e w) => ComonadEnv e (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods ask :: CofreeT f w a -> e #
(Functor f, Comonad w) => ComonadCofree f (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods unwrap :: CofreeT f w a -> f (CofreeT f w a) #
Functor f => ComonadHoist (CofreeT f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods cohoist :: (Comonad w, Comonad v) => (forall x. w x -> v x) -> CofreeT f w a -> CofreeT f v a #
ComonadTrans (CofreeT f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods lower :: Comonad w => CofreeT f w a -> w a #
Alternative f => MonadTrans (CofreeT f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods lift :: Monad m => m a -> CofreeT f m a #
(Alternative f, MonadZip f, MonadZip m) => MonadZip (CofreeT f m) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods mzip :: CofreeT f m a -> CofreeT f m b -> CofreeT f m (a, b) # mzipWith :: (a -> b -> c) -> CofreeT f m a -> CofreeT f m b -> CofreeT f m c # munzip :: CofreeT f m (a, b) -> (CofreeT f m a, CofreeT f m b) #
(Functor f, Comonad w) => Comonad (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods extract :: CofreeT f w a -> a # duplicate :: CofreeT f w a -> CofreeT f w (CofreeT f w a) # extend :: (CofreeT f w a -> b) -> CofreeT f w a -> CofreeT f w b #
(Alternative f, Applicative w) => Applicative (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods pure :: a -> CofreeT f w a # (<*>) :: CofreeT f w (a -> b) -> CofreeT f w a -> CofreeT f w b # liftA2 :: (a -> b -> c) -> CofreeT f w a -> CofreeT f w b -> CofreeT f w c # (*>) :: CofreeT f w a -> CofreeT f w b -> CofreeT f w b # (<*) :: CofreeT f w a -> CofreeT f w b -> CofreeT f w a #
(Functor f, Functor w) => Functor (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods fmap :: (a -> b) -> CofreeT f w a -> CofreeT f w b # (<$) :: a -> CofreeT f w b -> CofreeT f w a #
(Alternative f, Monad w) => Monad (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods (>>=) :: CofreeT f w a -> (a -> CofreeT f w b) -> CofreeT f w b # (>>) :: CofreeT f w a -> CofreeT f w b -> CofreeT f w b # return :: a -> CofreeT f w a #
(Foldable f, Foldable w) => Foldable (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods fold :: Monoid m => CofreeT f w m -> m # foldMap :: Monoid m => (a -> m) -> CofreeT f w a -> m # foldMap' :: Monoid m => (a -> m) -> CofreeT f w a -> m # foldr :: (a -> b -> b) -> b -> CofreeT f w a -> b # foldr' :: (a -> b -> b) -> b -> CofreeT f w a -> b # foldl :: (b -> a -> b) -> b -> CofreeT f w a -> b # foldl' :: (b -> a -> b) -> b -> CofreeT f w a -> b # foldr1 :: (a -> a -> a) -> CofreeT f w a -> a # foldl1 :: (a -> a -> a) -> CofreeT f w a -> a # toList :: CofreeT f w a -> [a] # null :: CofreeT f w a -> Bool # length :: CofreeT f w a -> Int # elem :: Eq a => a -> CofreeT f w a -> Bool # maximum :: Ord a => CofreeT f w a -> a # minimum :: Ord a => CofreeT f w a -> a # sum :: Num a => CofreeT f w a -> a # product :: Num a => CofreeT f w a -> a #
(Traversable f, Traversable w) => Traversable (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods traverse :: Applicative f0 => (a -> f0 b) -> CofreeT f w a -> f0 (CofreeT f w b) # sequenceA :: Applicative f0 => CofreeT f w (f0 a) -> f0 (CofreeT f w a) # mapM :: Monad m => (a -> m b) -> CofreeT f w a -> m (CofreeT f w b) # sequence :: Monad m => CofreeT f w (m a) -> m (CofreeT f w a) #
(Typeable f, Typeable w, Data (w (CofreeF f a (CofreeT f w a))), Data a) => Data (CofreeT f w a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CofreeT f w a -> c (CofreeT f w a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (CofreeT f w a) # toConstr :: CofreeT f w a -> Constr # dataTypeOf :: CofreeT f w a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (CofreeT f w a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (CofreeT f w a)) # gmapT :: (forall b. Data b => b -> b) -> CofreeT f w a -> CofreeT f w a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CofreeT f w a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CofreeT f w a -> r # gmapQ :: (forall d. Data d => d -> u) -> CofreeT f w a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CofreeT f w a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CofreeT f w a -> m (CofreeT f w a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CofreeT f w a -> m (CofreeT f w a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CofreeT f w a -> m (CofreeT f w a) #
Read (w (CofreeF f a (CofreeT f w a))) => Read (CofreeT f w a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods readsPrec :: Int -> ReadS (CofreeT f w a) # readList :: ReadS [CofreeT f w a] # readPrec :: ReadPrec (CofreeT f w a) # readListPrec :: ReadPrec [CofreeT f w a] #
Show (w (CofreeF f a (CofreeT f w a))) => Show (CofreeT f w a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods showsPrec :: Int -> CofreeT f w a -> ShowS # show :: CofreeT f w a -> String # showList :: [CofreeT f w a] -> ShowS #
Eq (w (CofreeF f a (CofreeT f w a))) => Eq (CofreeT f w a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods (==) :: CofreeT f w a -> CofreeT f w a -> Bool # (/=) :: CofreeT f w a -> CofreeT f w a -> Bool #
Ord (w (CofreeF f a (CofreeT f w a))) => Ord (CofreeT f w a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods compare :: CofreeT f w a -> CofreeT f w a -> Ordering # (<) :: CofreeT f w a -> CofreeT f w a -> Bool # (<=) :: CofreeT f w a -> CofreeT f w a -> Bool # (>) :: CofreeT f w a -> CofreeT f w a -> Bool # (>=) :: CofreeT f w a -> CofreeT f w a -> Bool # max :: CofreeT f w a -> CofreeT f w a -> CofreeT f w a # min :: CofreeT f w a -> CofreeT f w a -> CofreeT f w a #

type Cofree (f :: Type -> Type) = CofreeT f Identity #

The cofree `Comonad` of a functor `f`.

cofree :: forall (f :: Type -> Type) a. CofreeF f a (Cofree f a) -> Cofree f a #

Wrap another layer around a cofree comonad value.

`cofree` is a right inverse of `runCofree`.

    runCofree . cofree == id

runCofree :: forall (f :: Type -> Type) a. 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

data CofreeF (f :: Type -> Type) a b #

This is the base functor of the cofree comonad transformer.

Constructors

a :< (f b) infixr 5 |

#### Instances

Instances details

Generic1 (CofreeF f a :: Type -> Type) # |
Instance details Defined in Control.Comonad.Trans.Cofree Associated Types
type Rep1 (CofreeF f a :: Type -> Type) |
Instance details Defined in Control.Comonad.Trans.Cofree type Rep1 (CofreeF f a :: Type -> Type) = D1 ('MetaData "CofreeF" "Control.Comonad.Trans.Cofree" "free-5.2-80KVzMloHSZ6giRVM2rsod" 'False) (C1 ('MetaCons ":<" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
Methods from1 :: CofreeF f a a0 -> Rep1 (CofreeF f a) a0 # to1 :: Rep1 (CofreeF f a) a0 -> CofreeF f a a0 #
Foldable f => Bifoldable (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods bifold :: Monoid m => CofreeF f m m -> m # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> CofreeF f a b -> m # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> CofreeF f a b -> c # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> CofreeF f a b -> c #
Functor f => Bifunctor (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods bimap :: (a -> b) -> (c -> d) -> CofreeF f a c -> CofreeF f b d # first :: (a -> b) -> CofreeF f a c -> CofreeF f b c # second :: (b -> c) -> CofreeF f a b -> CofreeF f a c #
Traversable f => Bitraversable (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods bitraverse :: Applicative f0 => (a -> f0 c) -> (b -> f0 d) -> CofreeF f a b -> f0 (CofreeF f c d) #
Eq1 f => Eq2 (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> CofreeF f a c -> CofreeF f b d -> Bool #
Ord1 f => Ord2 (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> CofreeF f a c -> CofreeF f b d -> Ordering #
Read1 f => Read2 (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (CofreeF f a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [CofreeF f a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (CofreeF f a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [CofreeF f a b] #
Show1 f => Show2 (CofreeF f) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> CofreeF f a b -> ShowS # liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [CofreeF f a b] -> ShowS #
(Eq1 f, Eq a) => Eq1 (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftEq :: (a0 -> b -> Bool) -> CofreeF f a a0 -> CofreeF f a b -> Bool #
(Ord1 f, Ord a) => Ord1 (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftCompare :: (a0 -> b -> Ordering) -> CofreeF f a a0 -> CofreeF f a b -> Ordering #
(Read1 f, Read a) => Read1 (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (CofreeF f a a0) # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [CofreeF f a a0] # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (CofreeF f a a0) # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [CofreeF f a a0] #
(Show1 f, Show a) => Show1 (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> CofreeF f a a0 -> ShowS # liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [CofreeF f a a0] -> ShowS #
Functor f => Functor (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods fmap :: (a0 -> b) -> CofreeF f a a0 -> CofreeF f a b # (<$) :: a0 -> CofreeF f a b -> CofreeF f a a0 #
Foldable f => Foldable (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods fold :: Monoid m => CofreeF f a m -> m # foldMap :: Monoid m => (a0 -> m) -> CofreeF f a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> CofreeF f a a0 -> m # foldr :: (a0 -> b -> b) -> b -> CofreeF f a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> CofreeF f a a0 -> b # foldl :: (b -> a0 -> b) -> b -> CofreeF f a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> CofreeF f a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> CofreeF f a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> CofreeF f a a0 -> a0 # toList :: CofreeF f a a0 -> [a0] # null :: CofreeF f a a0 -> Bool # length :: CofreeF f a a0 -> Int # elem :: Eq a0 => a0 -> CofreeF f a a0 -> Bool # maximum :: Ord a0 => CofreeF f a a0 -> a0 # minimum :: Ord a0 => CofreeF f a a0 -> a0 # sum :: Num a0 => CofreeF f a a0 -> a0 # product :: Num a0 => CofreeF f a a0 -> a0 #
Traversable f => Traversable (CofreeF f a) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods traverse :: Applicative f0 => (a0 -> f0 b) -> CofreeF f a a0 -> f0 (CofreeF f a b) # sequenceA :: Applicative f0 => CofreeF f a (f0 a0) -> f0 (CofreeF f a a0) # mapM :: Monad m => (a0 -> m b) -> CofreeF f a a0 -> m (CofreeF f a b) # sequence :: Monad m => CofreeF f a (m a0) -> m (CofreeF f a a0) #
(Typeable f, Data a, Data (f b), Data b) => Data (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> CofreeF f a b -> c (CofreeF f a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (CofreeF f a b) # toConstr :: CofreeF f a b -> Constr # dataTypeOf :: CofreeF f a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (CofreeF f a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (CofreeF f a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> CofreeF f a b -> CofreeF f a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CofreeF f a b -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CofreeF f a b -> r # gmapQ :: (forall d. Data d => d -> u) -> CofreeF f a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CofreeF f a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CofreeF f a b -> m (CofreeF f a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CofreeF f a b -> m (CofreeF f a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CofreeF f a b -> m (CofreeF f a b) #
Generic (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree Associated Types
type Rep (CofreeF f a b) |
Instance details Defined in Control.Comonad.Trans.Cofree type Rep (CofreeF f a b) = D1 ('MetaData "CofreeF" "Control.Comonad.Trans.Cofree" "free-5.2-80KVzMloHSZ6giRVM2rsod" 'False) (C1 ('MetaCons ":<" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f b))))
Methods from :: CofreeF f a b -> Rep (CofreeF f a b) x # to :: Rep (CofreeF f a b) x -> CofreeF f a b #
(Read a, Read (f b)) => Read (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods readsPrec :: Int -> ReadS (CofreeF f a b) # readList :: ReadS [CofreeF f a b] # readPrec :: ReadPrec (CofreeF f a b) # readListPrec :: ReadPrec [CofreeF f a b] #
(Show a, Show (f b)) => Show (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods showsPrec :: Int -> CofreeF f a b -> ShowS # show :: CofreeF f a b -> String # showList :: [CofreeF f a b] -> ShowS #
(Eq a, Eq (f b)) => Eq (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods (==) :: CofreeF f a b -> CofreeF f a b -> Bool # (/=) :: CofreeF f a b -> CofreeF f a b -> Bool #
(Ord a, Ord (f b)) => Ord (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods compare :: CofreeF f a b -> CofreeF f a b -> Ordering # (<) :: CofreeF f a b -> CofreeF f a b -> Bool # (<=) :: CofreeF f a b -> CofreeF f a b -> Bool # (>) :: CofreeF f a b -> CofreeF f a b -> Bool # (>=) :: CofreeF f a b -> CofreeF f a b -> Bool # max :: CofreeF f a b -> CofreeF f a b -> CofreeF f a b # min :: CofreeF f a b -> CofreeF f a b -> CofreeF f a b #
type Rep1 (CofreeF f a :: Type -> Type) # |
Instance details Defined in Control.Comonad.Trans.Cofree type Rep1 (CofreeF f a :: Type -> Type) = D1 ('MetaData "CofreeF" "Control.Comonad.Trans.Cofree" "free-5.2-80KVzMloHSZ6giRVM2rsod" 'False) (C1 ('MetaCons ":<" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
type Rep (CofreeF f a b) # |
Instance details Defined in Control.Comonad.Trans.Cofree type Rep (CofreeF f a b) = D1 ('MetaData "CofreeF" "Control.Comonad.Trans.Cofree" "free-5.2-80KVzMloHSZ6giRVM2rsod" 'False) (C1 ('MetaCons ":<" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f b))))

class (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.

#### Instances

Instances details

ComonadCofree Maybe NonEmpty # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: NonEmpty a -> Maybe (NonEmpty a) #
ComonadCofree [] Tree # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: Tree a -> [Tree a] #
Comonad w => ComonadCofree Identity (CoiterT w) # |
Instance details Defined in Control.Comonad.Trans.Coiter Methods unwrap :: CoiterT w a -> Identity (CoiterT w a) #
Functor f => ComonadCofree f (Cofree f) # |
Instance details Defined in Control.Comonad.Cofree Methods unwrap :: Cofree f a -> f (Cofree f a) #
ComonadCofree f w => ComonadCofree f (EnvT e w) # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: EnvT e w a -> f (EnvT e w a) #
ComonadCofree f w => ComonadCofree f (StoreT s w) # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: StoreT s w a -> f (StoreT s w a) #
(ComonadCofree f w, Monoid m) => ComonadCofree f (TracedT m w) # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: TracedT m w a -> f (TracedT m w a) #
(Functor f, Comonad w) => ComonadCofree f (CofreeT f w) # |
Instance details Defined in Control.Comonad.Trans.Cofree Methods unwrap :: CofreeT f w a -> f (CofreeT f w a) #
ComonadCofree f w => ComonadCofree f (IdentityT w) # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: IdentityT w a -> f (IdentityT w a) #
ComonadCofree (Const b :: Type -> Type) ((,) b) # |
Instance details Defined in Control.Comonad.Cofree.Class Methods unwrap :: (b, a) -> Const b (b, a) #

headF :: forall (f :: Type -> Type) a b. CofreeF f a b -> a #

Extract the head of the base functor

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

Extract the tails of the base functor

transCofreeT :: forall g (w :: Type -> Type) f a. (Functor g, Comonad w) => (forall x. f x -> g x) -> CofreeT f w a -> CofreeT g w a #

Lift a natural transformation from `f` to `g` into a comonad homomorphism from ``CofreeT` f w` to ``CofreeT` g w`

coiterT :: (Functor f, Comonad w) => (w a -> f (w a)) -> w a -> CofreeT f w a #

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