Search results

This type class captures those monads which support tail recursion in constant stack space.

The tailRecM function takes a step function, and applies that step function recursively until a pure value of type b is found.

Instances are provided for standard monad transformers.

For example:

loopWriter :: Int -> WriterT (Additive Int) Effect Unit
loopWriter n = tailRecM go n
  where
  go 0 = do
    traceM "Done!"
    pure (Done unit)
  go i = do
    tell $ Additive i
    pure (Loop (i - 1))
P purescript-tailrec M Control.Monad.Rec.Class
P purescript-st M Control.Monad.ST.Internal

This instance is provided for compatibility. Aff is always stack-safe within a given fiber. This instance will just result in unnecessary bind overhead.

P purescript-aff M Effect.Aff
P purescript-quickcheck M Test.QuickCheck.Gen

This instance is provided for compatibility, but is otherwise unnecessary. You can use monadic recursion with Run, deferring the MonadRec constraint till it is interpretted.

P purescript-run M Run
P purescript-transformerless M Control.Monad.Transformerless.RWS
P purescript-transformers M Control.Monad.RWS.Trans
P purescript-web3 M Network.Ethereum.Web3.Types.Types
P purescript-bucketchain-simple-api M Bucketchain.SimpleAPI.Proc
P purescript-redux-saga M Redux.Saga
P purescript-tailrec M Control.Monad.Rec.Class
P purescript-pipes M Pipes.Internal
P purescript-spec M Test.Spec
P purescript-freet M Control.Monad.Free.Trans
P purescript-transformerless M Control.Monad.Transformerless.State
P purescript-wire M Wire.Event
P purescript-react-halo M React.Halo.Internal.Control
P purescript-tailrec M Control.Monad.Rec.Class
P purescript-tailrec M Control.Monad.Rec.Class
P purescript-transformers M Control.Monad.Maybe.Trans
P purescript-transformers M Control.Monad.State.Trans
P purescript-string-parsers M StringParser.Parser
P purescript-grain M Grain.UI
P purescript-jack M Jack.Random
P purescript-wire M Wire.Signal
P purescript-transformers M Control.Monad.Except.Trans
P purescript-transformers M Control.Monad.Reader.Trans
P purescript-transformers M Control.Monad.Writer.Trans
P purescript-bucketchain M Bucketchain.Middleware
P purescript-game M Game.Aff
P purescript-monad-logger M Control.Monad.Logger.Trans
P purescript-tailrec M Control.Monad.Rec.Class
P purescript-tailrec M Control.Monad.Rec.Class
P purescript-halogen M Halogen.Query.HalogenM
P purescript-grid-reactors M Reactor.Graphics.Drawing
P purescript-grid-reactors M Reactor.Reaction
P purescript-vexceptt M Control.Monad.VexceptT
P purescript-transformers M Control.Monad.Identity.Trans
P purescript-echarts M ECharts.Monad
P purescript-resourcet M Control.Monad.Resource.Trans
P purescript-conveyor M Conveyor.AuthHandler
P purescript-conveyor M Conveyor.Handler
P purescript-ssh2-sftp-client M Node.Network.SftpClient

No further results.