Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Add Resource type #2

Description

@chuwy

It's a common task in IO related code to finalize some IO action, e.g. perform file.close or socket.close when those resources aren't needed anymore. In Http.lean we need to use it to handle connections. Later it can be a great candidate for a separate lib or stdlib.

In general it has the following structure:

  1. The acquire action of IO α
  2. The release action of α → IO Unit
  3. use function of α → IO β
  4. Monad instance

Examples:

  1. Haskell
  2. Scala

It's a bit problematic though given how much typical FP instances are in Mathlib4 - I suspect we might need to depend on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions