tweag / tweag/linear-base

Eq and Ord classes don't seem very useful

Open
#447 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
359
Forks
45
PR merge metrics
No merged PRs in 30d

Description

I could be wrong, but it seems to be that having == and (probably) compare consume their arguments is wrong for the vast majority of types that need to be handled linearly. I would expect something more like

class Eq a where
  (==) :: a %1-> a %1-> (Bool, a, a) -- return both values in case `==` is not structural equality
class Eq a => Ord a where
  compare :: a %1-> a %1-> (Ordering, a, a)
  (<=) :: a %1-> a %1-> (Bool, a, a)
  ...

Contributor guide

Open the contributing guide

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

The issue names no files or tests; start by locating the existing Eq and Ord class definitions and their usages. Compare them with the proposed linear signatures, then seek a maintainer-approved design before implementing it and adding coverage for the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.