avh4 / avh4/elm-format

Automatically generated 'exposing' block feels like a hindrance

Open
#573 11 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
1.3k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

**Working in a small project where I'm quickly adding a lot of functions and renaming things often**

Lately I noticed that elm-format has started replacing this:

`module Staff exposing (..)`

with this

`module Staff exposing (Accidental(..), AccidentalSymbol(..), KeySig, KsLookup, MidiNotes, PcNote, PitchClass(..), Staff, StaffNote, aToAs, adjacentPitch, aflatmajor, allPitchClasses, allkeys, amajor, bassStaff, bflatmajor, bmajor, cmajor, dflatmajor, dmajor, dropEvry, eflatmajor, emajor, fmajor, gmajor, intToPc, ksLookup, ledgerLine, ledgerLines, makeTrebleStaff, midiToPcNote, midiToStaffNote, note, pcDEmpty, pcIndex, pcLookup, pcNoteToStaffNote, pcToInt, pitchClassEmptySet, staffToY, staffline, toNotes, trebleStaff, view, what)
`

In my current project I've got several small modules and I'm iterating on my design quickly, and I don't really want to maintain the 'exposing' clause at the moment. I find myself going up there and deleting it several times a day so that elm-format will replace it with the full clause.

**You know what would be cool?**

If you did this:

`module Staff auto`

or maybe:

`module Staff where`

Then elm-format would generate the big exposing, and then I could whittle that down into my stable interface. Otherwise elm-format would leave it alone, so that

`module Staff exposing (..) `

wouldn't change. Or maybe vice versa?

If we must generate a huge 'exposing' clause, it would be nice to remove functions from it when they are renamed. It would be better to actually rename them, but that's probably hard to do reliably.

**Trying to debug at the repl**

The other issue I ran into was that I was trying to debug a module at the repl - one which has docs. I wasn't able to add extra functions to the exposing because elm-format rewrites the exposing clause to only contain functions from the docs each time.

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 tracing elm-format's handling of Elm module exposing clauses. Compare the requested auto-generated form with the current behavior for `exposing (..)` and modules with documentation, including the REPL workflow. Done means the intended syntax and preservation rules are agreed and covered for both formatting scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.