tweag / tweag/linear-base

Don't export `fst` (and alike) from `Prelude.Linear`

Open
#405 7 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

It is surprising that Prelude.Linear exports the non-linear version of projection fst :: (a,b) -> a.
This tripped me up (with non-inspiring errors about multiplicity) when writing evalState:

  • #404

I was naturally expecting that fst :: Consumable b => (a,b) -> a would be by default in scope if a fst is in scope. After all, we want linear programs when we import Prelude.Linear!
So, I suggest either to not export fst (and alike) or export them from Data.Tuple.Linear.

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

Inspect the exports in Prelude.Linear and the related API in Data.Tuple.Linear, then read the linked #404 context. Decide whether fst and related projections should be removed from Prelude.Linear or moved to Data.Tuple.Linear; done means the chosen export policy is consistent and documented by the resulting module interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
developer-experience
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.