Synopsis

# Documentation

This type class generalizes over encodings of Free Monads.

Methods

Arguments

 :: m a -> m (Either a (f (m a))) `Opens` a computation and allows to observe the side effects

Arguments

 :: f (m a) -> m a Wraps a side effect into a monadic computation

Instances

 Functor f => MonadFree f (Free f) Functor f => MonadFree f (C (Free f)) (Functor f, Monad m) => MonadFree f (FreeT f m)

data Free f a Source

Constructors

 Impure (f (Free f a)) Pure a

Instances

 Functor f => MonadFree f (Free f) Functor f => MonadFree f (C (Free f)) Functor f => Monad (Free f) Functor f => Functor (Free f) (Functor f, Foldable f) => Foldable (Free f) Traversable f => Traversable (Free f) (Eq a, Eq (f (Free f a))) => Eq (Free f a) (Ord a, Ord (f (Free f a))) => Ord (Free f a) (Show a, Show (f (Free f a))) => Show (Free f a) (NFData a, NFData (f (Free f a))) => NFData (Free f a)

foldFree :: Functor f => (a -> b) -> (f b -> b) -> Free f a -> bSource

evalFree :: (a -> b) -> (f (Free f a) -> b) -> Free f a -> bSource

mapFree :: (Functor f, Functor g) => (f (Free g a) -> g (Free g a)) -> Free f a -> Free g aSource

mapFreeM :: (Traversable f, Functor g, Monad m) => (f (Free g a) -> m (g (Free g a))) -> Free f a -> m (Free g a)Source

mapFreeM' :: (Functor f, Traversable g, Monad m) => (forall a. f a -> m (g a)) -> Free f a -> m (Free g a)Source

foldFreeM :: (Traversable f, Monad m) => (a -> m b) -> (f b -> m b) -> Free f a -> m bSource

induce :: (Functor f, Monad m) => (forall a. f a -> m a) -> Free f a -> m aSource

newtype FreeT f m a Source

Constructors

 FreeT FieldsunFreeT :: m (Either a (f (FreeT f m a)))

Instances

 (Functor f, Monad m) => MonadFree f (FreeT f m) Functor f => MonadTrans (FreeT f) (Functor f, Monad m) => Monad (FreeT f m) (Functor f, Functor m) => Functor (FreeT f m) (Traversable m, Traversable f) => Foldable (FreeT f m) (Traversable m, Traversable f) => Traversable (FreeT f m)

foldFreeT :: (Traversable f, Monad m) => (a -> m b) -> (f b -> m b) -> FreeT f m a -> m bSource

foldFreeT' :: (Traversable f, Monad m) => (a -> b) -> (f b -> b) -> FreeT f m a -> m bSource

mapFreeT :: (Functor f, Functor m) => (forall a. m a -> m' a) -> FreeT f m a -> FreeT f m' aSource