I seem to remember reading somewhere that there’s a convention not to use names like Retry.retry in libraries. Is there ever an occasion where you might want to use Retry.retry and then do something other than Http.send as a next step? If not, then maybe it’s simpler to bundle up the Http.send into your library and provide functions like Retry.send and Retry.sendWith?

I like it. Retry.send and Retry.sendWith fix both problems at once. Even better now the programmer can naturally understand this as a function that returns a Cmd, like Http.send does. Task abstraction out-of-sight, out-of-mind! I added a revision 2 to the post.

Not sure it makes sense to retry a pure function that returns a Result… it’s always going to return the same Result given the same input. But I can see writing a generic retry that works with any Task. This is kind of diametrically opposed to the API that @1hko is interested in, but something like this could work: