Improve type roles for key-value queues
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 17
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
This might be controversial because it requires `unsafeCoerce` and really wants pattern synonyms too, but I'll put it here anyway. We really want the *values* in a key-value queue to have a `representational` role. This doesn't work out "natively" because of the higher-order type arguments. But we could *make* it happen.
```haskell
newtype MinPQueue k a = MkMinPQueue (MinPQueue_ k Any)
type role MinPQueue nominal representational
```
We need `unsafeCoerce` to move between `MinPQueue_ k a` and `MinPQueue k a`.
Contributor guide
No contributing guide indexed for this repository
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
Start by reading the MinPQueue and MinPQueue_ type definitions and the proposed role declaration in the issue. Investigate how unsafeCoerce and pattern synonyms would connect the two representations, then verify that key types remain nominal while value types have a representational role. Done means the intended role behavior works without changing the queue's public semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100