$ show discord-haskell/discord-haskell
discord-haskell is a Haskell library for building Discord bots. It provides type-safe bindings to the Discord API, handling both REST requests and WebSocket gateway connections. The library features automatic rate limiting, resilient connection handling with reconnection logic, optional caching of guild/channel/user data, and comprehensive support for Discord interactions including slash commands, buttons, select menus, and modals. Built with a modular architecture separating gateway, REST, and type concerns, it uses ReaderT for dependency injection and provides a clean interface for bot developers.
The LLM identified 2 files worth highlighting for reuse:
Implements sophisticated rate limiting with global and route-specific buckets, handling 429 responses and retry-after headers. Demonstrates non-obvious skill in API rate limiting logic that could be extracted for use with any HTTP API.
Provides a typesafe Snowflake implementation as a newtype wrapper around Word64 with proper JSON instances and creation date extraction. This isolated, reusable component demonstrates excellent Haskell type safety practices for working with Discord's snowflake IDs.