Module

Control.Monad.Trampoline

Package
purescript-free
Repository
purescript/purescript-free

A trampoline monad, which can be used at the bottom of a monad transformer stack to avoid stack overflows in large monadic computations.

#Trampoline Source

type Trampoline = Free Lazy

The Trampoline monad

A computation of type Trampoline a consists of zero or more lazy suspensions before a value is returned.

#done Source

done :: forall a. a -> Trampoline a

Return a value immediately

#suspend Source

suspend :: forall a. Trampoline a -> Trampoline a

Suspend a computation by one step.

#delay' Source

delay' :: forall a. Lazy a -> Trampoline a

Use the Trampoline monad to represent a Lazy value.

#delay Source

delay :: forall a. (Unit -> a) -> Trampoline a

Use the Trampoline monad to represent the delayed evaluation of a value.

#runTrampoline Source

runTrampoline :: forall a. Trampoline a -> a

Run a computation in the Trampoline monad.