characterization of subset of Monads that respect tail calls?

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Tue Sep 27 18:05:30 UTC 2022


On Mon, Sep 26, 2022 at 04:38:47PM -0400, Carter Schonwald wrote:
> is there a good interface or something for Monads which guarantee
> tail calls are tail calls? (ideally via a stronger api assumption
> for tail position computations in a monad rather than "trustme"
> style api contracts)

*> is exactly for tail calls, isn't it?  Consider its type

    (*>) :: m a -> m b -> m b

It looks like it is saying that it doesn't need to save any of the
context from the 'm a' call during evaluation of the 'm b' call,
because the overall result is just the result of the 'm b' call.

Is that what you were looking for, or was it something else?

Tom


More information about the Libraries mailing list