lspitzner / lspitzner/pqueue

Improve type roles for key-value queues

Open
#27 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.