A production-grade circuit breaker library for Haskell.
The circuit breaker pattern prevents cascading failures in distributed systems by detecting failures and failing fast when a dependency becomes unavailable.
build-depends: circuit-breakerimport CircuitBreaker
main :: IO ()
main = do
cb <- newCircuitBreaker defaultConfig
result <- withCircuitBreaker cb $ do
-- Your protected operation here
pure "success"
print result- Thread-safe state management using STM
- Configurable failure thresholds and timeouts
- Count-based sliding window for failure rate calculation
- Optional OpenTelemetry integration for observability
- Composable combinators (timeout, fallback)
See Hackage for full API documentation.
BSD-3-Clause - see LICENSE for details.