Idris2Doc : Control.MonadRec

Control.MonadRec

(source)

Reexports

importpublic Control.WellFounded
importpublic Data.Fuel
importpublic Data.Nat

Definitions

dataStep : (a->a->Type) ->a->Type->Type->Type
  Single step in a recursive computation.

A `Step` is either `Done`, in which case we return the
final result, or `Cont`, in which case we continue
iterating. In case of a `Cont`, we get a new seed for
the next iteration plus an updated state. In addition
we proof that the sequence of seeds is related via `rel`.
If `rel` is well-founded, the recursion will provably
come to an end in a finite number of steps.

Totality: total
Visibility: public export
Constructors:
Cont : (seed2 : a) -> (0_ : relseed2seed) ->st->Steprelseedstres
  Keep iterating with a new `seed2`, which is
related to the current `seed` via `rel`.
`vst` is the accumulated state of the iteration.
Done : res->Steprelvstres
  Stop iterating and return the given result.

Hint: 
Bifunctor (Steprelseed)
interfaceMonadRec : (Type->Type) ->Type
  Interface for tail-call optimized monadic recursion.

Parameters: m
Constraints: Monad m
Methods:
tailRecM : (seed : a) ->st-> (0_ : Accessiblerelseed) -> ((seed2 : a) ->st->m (Steprelseed2stb)) ->mb
  Implementers mus make sure they implement this function
in a tail recursive manner.
The general idea is to loop using the given `step` function
until it returns a `Done`.

To convey to the totality checker that the sequence
of seeds generated during recursion must come to an
end after a finite number of steps, this function
requires an erased proof of accessibility.

Implementations:
MonadRecIdentity
MonadRecMaybe
MonadRec (Eithere)
MonadRecIO
MonadRecm=>MonadRec (StateTsm)
MonadRecm=>MonadRec (EitherTem)
MonadRecm=>MonadRec (MaybeTm)
MonadRecm=>MonadRec (ReaderTem)
MonadRecm=>MonadRec (WriterTwm)
MonadRecm=>MonadRec (RWSTrwsm)
tailRecM : MonadRecm=> (seed : a) ->st-> (0_ : Accessiblerelseed) -> ((seed2 : a) ->st->m (Steprelseed2stb)) ->mb
  Implementers mus make sure they implement this function
in a tail recursive manner.
The general idea is to loop using the given `step` function
until it returns a `Done`.

To convey to the totality checker that the sequence
of seeds generated during recursion must come to an
end after a finite number of steps, this function
requires an erased proof of accessibility.

Totality: total
Visibility: public export
trSized : MonadRecm=> {auto0{conArg:3143} : Sizeda} ->a->st-> ((v : a) ->st->m (StepSmallervstb)) ->mb
  Monadic tail recursion over a sized structure.

Totality: total
Visibility: public export