Stamina: Haskell library for retries

Domen Kožar

As we deal with networking and databases in our day-to-day work, Haskell exceptions frequently arise in our code.

We’ve been using the Haskell retry package for retrying exceptions so far, but it presents several issues:

Heavily inspired by Hynek’s Stamina for Python, we’re releasing Stamina for Haskell:

Basic example

import qualified Stamina
import Control.Monad.Catch (throwM)

go :: IO ()
go = Stamina.retry Stamina.defaults $ \retryStatus -> do
  print $ show $ Stamina.lastException retryStatus
  throwM $ userError "nope"

For more examples see