haskell / haskell/stylish-haskell

CPP inside import hiding list is thrown away

Open
#178 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haskell
Stars
1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/ekmett/trifecta/pull/73/commits/90d3ea3d568b41806b36910d7a3f7ba19b48573c#diff-5ce974d71a85ffa9de2bd3160230ad6aL61:

Before:
```haskell
import Control.Lens
hiding ((<|),(|>)
#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710
,(:<)
#endif
)
```

After applying stylish-haskell:

```haskell
import Control.Lens hiding ((:<), (<|), (|>))
```

Although I'm able to work around this problem, I'd rather have `stylish-haskell` leave it as-is, or refuse to format this file, than throwing away CPPs and thus inadvertedly breaking the build.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked stylish-haskell diff and reproduce the formatting of the CPP-guarded import example from the issue. Trace how the import's hiding list is processed, then verify that CPP directives are preserved or the file is refused rather than silently changed.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.