[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"Y5r3u91DYy":3},"\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"logo-dark.svg\">\n    \u003Cimg src=\"logo.svg\" alt=\"H∀L∃\" width=\"420\">\n  \u003C/picture>\n\u003C/p>\n\n\u003Cp align=\"center\">\n  Haskell's web ecosystem, ported to Lean 4 with maximalist typing.\n\u003C/p>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https://github.com/typednotes/hale/actions\">\u003Cimg src=\"https://github.com/typednotes/hale/workflows/CI/badge.svg\" alt=\"CI\">\u003C/a>\n  \u003Ca href=\"https://typednotes.github.io/hale/\">\u003Cimg src=\"https://img.shields.io/badge/docs-mdBook-blue\" alt=\"Docs\">\u003C/a>\n  \u003Ca href=\"https://github.com/typednotes/hale/stargazers\">\u003Cimg src=\"https://img.shields.io/github/stars/typednotes/hale?style=flat\" alt=\"GitHub Stars\">\u003C/a>\n  \u003Ca href=\"https://github.com/typednotes/hale/blob/main/LICENSE\">\u003Cimg src=\"https://img.shields.io/github/license/typednotes/hale\" alt=\"License\">\u003C/a>\n  \u003Ca href=\"https://github.com/typednotes/hale\">\u003Cimg src=\"https://img.shields.io/github/last-commit/typednotes/hale\" alt=\"Last Commit\">\u003C/a>\n  \u003Ca href=\"https://lean-lang.org/\">\u003Cimg src=\"https://img.shields.io/badge/Lean-4.29.0-blue\" alt=\"Lean 4\">\u003C/a>\n\u003C/p>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>257 compile-time theorems\u003C/strong> · \u003Cstrong>45 ported libraries\u003C/strong> · \u003Cstrong>241 Lean modules\u003C/strong>\n\u003C/p>\n\n## Overview\n\n`hale` ports 45 Haskell libraries (241 Lean modules) covering everything from foundational types to a full HTTP/1-2-3 web server stack. Unlike a minimal port, types encode correctness proofs, invariants, and guarantees wherever feasible:\n\n- **Correctness:** Lawful typeclasses (`LawfulBifunctor`, `LawfulCategory`, `LawfulTraversable`) with verified laws\n- **Invariants:** `Ratio` enforces positive denominator and coprimality in its type; `NonEmpty` guarantees `length >= 1`\n- **Proofs:** `clamp` returns `{y : a // lo \u003C= y && y \u003C= hi}`; `Fixed.add_exact` proves addition preserves precision\n- **257 compile-time verified theorems** across 52 files, checked by the Lean 4 kernel\n\n## Quick Start\n\nAdd to your `lakefile.toml`:\n\n```toml\n[[require]]\nname = \"hale\"\ngit = \"\u003Crepository-url>\"\nrev = \"main\"\n```\n\nThen import:\n\n```lean\nimport Hale\nopen Hale\n```\n\n## Ported Libraries\n\n### Core Infrastructure\n\n| Lean Package | Haskell Package | Description |\n|---|---|---|\n| `Hale.Base` | [base](https://hackage.haskell.org/package/base) | Foundational types, functors, monads, concurrency |\n| `Hale.ByteString` | [bytestring](https://hackage.haskell.org/package/bytestring) | Byte array operations (strict, lazy, builder) |\n| `Hale.Word8` | [word8](https://hackage.haskell.org/package/word8) | Word8 character classification |\n| `Hale.Time` | [time](https://hackage.haskell.org/package/time) | Clock and time types |\n| `Hale.STM` | [stm](https://hackage.haskell.org/package/stm) | Software transactional memory |\n| `Hale.DataDefault` | [data-default](https://hackage.haskell.org/package/data-default) | Default values |\n| `Hale.ResourceT` | [resourcet](https://hackage.haskell.org/package/resourcet) | Resource management monad |\n| `Hale.UnliftIO` | [unliftio-core](https://hackage.haskell.org/package/unliftio-core) | MonadUnliftIO |\n| `Hale.Conduit` | [conduit](https://hackage.haskell.org/package/conduit) | Composable streaming data pipelines |\n\n### Networking\n\n| Lean Package | Haskell Package | Description |\n|---|---|---|\n| `Hale.Network` | [network](https://hackage.haskell.org/package/network) | POSIX sockets with phantom state |\n| `Hale.IpRoute` | [iproute](https://hackage.haskell.org/package/iproute) | IP address types |\n| `Hale.Recv` | [recv](https://hackage.haskell.org/package/recv) | Socket receive |\n| `Hale.StreamingCommons` | [streaming-commons](https://hackage.haskell.org/package/streaming-commons) | Streaming network utilities |\n| `Hale.SimpleSendfile` | [simple-sendfile](https://hackage.haskell.org/package/simple-sendfile) | sendfile(2) wrapper |\n| `Hale.TLS` | [tls](https://hackage.haskell.org/package/tls) | TLS via OpenSSL FFI |\n\n### HTTP\n\n| Lean Package | Haskell Package | Description |\n|---|---|---|\n| `Hale.HttpTypes` | [http-types](https://hackage.haskell.org/package/http-types) | HTTP methods, status, headers, URI |\n| `Hale.HttpDate` | [http-date](https://hackage.haskell.org/package/http-date) | HTTP date parsing |\n| `Hale.Http2` | [http2](https://hackage.haskell.org/package/http2) | HTTP/2 framing, HPACK, server |\n| `Hale.Http3` | [http3](https://hackage.haskell.org/package/http3) | HTTP/3 framing, QPACK |\n| `Hale.QUIC` | [quic](https://hackage.haskell.org/package/quic) | QUIC transport |\n| `Hale.BsbHttpChunked` | [bsb-http-chunked](https://hackage.haskell.org/package/bsb-http-chunked) | Chunked transfer encoding |\n| `Hale.HttpClient` | [http-client](https://hackage.haskell.org/package/http-client) | HTTP client with pluggable transport |\n| `Hale.HttpConduit` | [http-conduit](https://hackage.haskell.org/package/http-conduit) | HTTP + Conduit integration |\n| `Hale.Req` | [req](https://hackage.haskell.org/package/req) | Type-safe HTTP client |\n\n### Web Application Interface\n\n| Lean Package | Haskell Package | Description |\n|---|---|---|\n| `Hale.WAI` | [wai](https://hackage.haskell.org/package/wai) | Request/Response/Application/Middleware |\n| `Hale.Warp` | [warp](https://hackage.haskell.org/package/warp) | HTTP/1.x server |\n| `Hale.WarpTLS` | [warp-tls](https://hackage.haskell.org/package/warp-tls) | HTTPS via OpenSSL |\n| `Hale.WarpQUIC` | [warp-quic](https://hackage.haskell.org/package/warp-quic) | HTTP/3 over QUIC |\n| `Hale.WaiExtra` | [wai-extra](https://hackage.haskell.org/package/wai-extra) | 36 middleware modules |\n| `Hale.WaiAppStatic` | [wai-app-static](https://hackage.haskell.org/package/wai-app-static) | Static file serving |\n| `Hale.WaiHttp2Extra` | [wai-http2-extra](https://hackage.haskell.org/package/wai-http2-extra) | HTTP/2 server push |\n| `Hale.WaiWebSockets` | [wai-websockets](https://hackage.haskell.org/package/wai-websockets) | WebSocket WAI handler |\n| `Hale.WebSockets` | [websockets](https://hackage.haskell.org/package/websockets) | RFC 6455 WebSocket protocol |\n\n### Utilities\n\n| Lean Package | Haskell Package | Description |\n|---|---|---|\n| `Hale.CaseInsensitive` | [case-insensitive](https://hackage.haskell.org/package/case-insensitive) | Case-insensitive strings |\n| `Hale.Vault` | [vault](https://hackage.haskell.org/package/vault) | Type-safe heterogeneous storage |\n| `Hale.AutoUpdate` | [auto-update](https://hackage.haskell.org/package/auto-update) | Periodic cached values |\n| `Hale.TimeManager` | [time-manager](https://hackage.haskell.org/package/time-manager) | Connection timeout management |\n| `Hale.Cookie` | [cookie](https://hackage.haskell.org/package/cookie) | HTTP cookie parsing |\n| `Hale.MimeTypes` | [mime-types](https://hackage.haskell.org/package/mime-types) | MIME type lookup |\n| `Hale.Base64` | [base64-bytestring](https://hackage.haskell.org/package/base64-bytestring) | RFC 4648 codec |\n| `Hale.FastLogger` | [fast-logger](https://hackage.haskell.org/package/fast-logger) | Buffered thread-safe logging |\n| `Hale.WaiLogger` | [wai-logger](https://hackage.haskell.org/package/wai-logger) | WAI request logging |\n| `Hale.UnixCompat` | [unix-compat](https://hackage.haskell.org/package/unix-compat) | POSIX compatibility |\n| `Hale.AnsiTerminal` | [ansi-terminal](https://hackage.haskell.org/package/ansi-terminal) | Terminal ANSI codes |\n| `Hale.PSQueues` | [psqueues](https://hackage.haskell.org/package/psqueues) | Priority search queues |\n\n### Data\n\n| Lean Package | Haskell Package | Description |\n|---|---|---|\n| `Hale.DataFrame` | dataframe (adapted) | Tabular data with typed columns, CSV I/O |\n\n## Typing Philosophy\n\nLean 4 is a dependently-typed proof assistant that compiles to efficient native\ncode. Hale leverages this to turn protocol specs, resource lifecycles, and\nalgebraic laws into **compile-time obligations** -- verified by the kernel,\nthen **erased at runtime** (zero overhead).\n\n- **Phantom state machines:** `Socket (state : SocketState)` makes it a type\n  error to `send` on an unconnected socket or `close` an already-closed one\n  (proof obligation: `state != .closed`, discharged by `decide`)\n- **Indexed monads:** `AppM .pending .sent ResponseReceived` enforces that\n  a WAI application calls `respond` exactly once -- double-respond is a\n  compile-time error, not a runtime crash\n- **Proof-carrying structures:** `Ratio` carries `den_pos` and `coprime`\n  proofs; `Settings` carries `timeout_pos` -- all erased at runtime (zero cost)\n- **Algebraic laws:** 257 theorems (`bimap_id`, `bind_assoc`, `map_id`,\n  `connAction_http11_default`, ...) verified by the Lean kernel\n\n## Documentation\n\n- [docs/](docs/README.md) -- Per-module documentation with API mappings and examples\n- [docs/Proofs.md](docs/Proofs.md) -- Complete catalog of all 257 theorems\n- [Tests/](Tests/) -- 82 Lean test files\n- [Tests/cross-check/](Tests/cross-check/) -- 9 Haskell cross-verification scripts\n\n## Build & Test\n\n```bash\nnix-shell                               # Nix users: enter shell with OpenSSL + pkg-config\nlake build                              # Build the library\nlake exe hale                           # Run smoke tests\nlake build hale-tests && lake exe hale-tests  # Run test suite\nbash tests/cross-check/run-all.sh       # Cross-check with Haskell (requires GHC)\n```\n\nRequires OpenSSL headers for TLS support. On non-Nix systems, ensure `pkg-config openssl` works (e.g., `brew install openssl pkg-config` on macOS, `apt install libssl-dev pkg-config` on Debian/Ubuntu).\n\n## License\n\nSee [LICENSE](LICENSE) for details.\n",1780241995616]