Module

Control.Monad.Free.Trans

Package
purescript-freet
Repository
paf31/purescript-freet

This module defines a stack-safe implementation of the free monad transformer.

#FreeT Source

data FreeT f m a

The free monad transformer for the functor f.

Instances

#freeT Source

freeT :: forall a m f. (Unit -> m (Either a (f (FreeT f m a)))) -> FreeT f m a

Construct a computation of type FreeT.

#resume Source

resume :: forall a m f. Functor f => MonadRec m => FreeT f m a -> m (Either a (f (FreeT f m a)))

Unpack FreeT, exposing the first step of the computation.

#liftFreeT Source

liftFreeT :: forall a m f. Functor f => Monad m => f a -> FreeT f m a

Lift an action from the functor f to a FreeT action.

#hoistFreeT Source

hoistFreeT :: forall a n m f. Functor f => Functor n => (m ~> n) -> FreeT f m a -> FreeT f n a

Change the underlying Monad for a FreeT action.

#interpret Source

interpret :: forall a m g f. Functor f => Functor m => (f ~> g) -> FreeT f m a -> FreeT g m a

Change the base functor f for a FreeT action.

#bimapFreeT Source

bimapFreeT :: forall a n m g f. Functor f => Functor n => (f ~> g) -> (m ~> n) -> FreeT f m a -> FreeT g n a

Change the base functor f and the underlying Monad for a FreeT action.

#runFreeT Source

runFreeT :: forall a m f. Functor f => MonadRec m => (f (FreeT f m a) -> m (FreeT f m a)) -> FreeT f m a -> m a

Run a FreeT computation to completion.