Dispose with side effects
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 359
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
The module Data.Unrestricted.Linear provides tools for manipulating linear values non-linearly. One of them is given by the type class Consumable whose single class method consume :: a %1 -> () allows us to consume or drop a linear value of type a, by returning an unit type ().
However, sometimes consuming a linear value might cause an effect, for example deallocating a memory cell. I think it would be nice to capture situations like this in the module Data.Unrestricted.Linear by defining a type class Disposable
class Disposable a where
dispose :: a %1 -> IO ()
which would generalise Consumable
instance Consumable a => Disposable a where
dispose x = return (consume x)
Of course, something similar could be done for Dupable and Moveable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to Data.Unrestricted.Linear and the Consumable class; start by locating that module and its existing Consumable, Dupable, and Moveable definitions. Clarify the intended Disposable generalization and related instances with maintainers, then add focused coverage once the API is agreed; done means the agreed effectful disposal API is implemented and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100