haskell / haskell/stylish-haskell

feature: marker to ignore the following block

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

Description

I occasionally run into situations where I want to manually format a block, e.g. with `servant-openapi3`:

```haskell
-- | The Work API
-- ...
data WorkAPI n mode = WorkAPI
{ workCreate :: mode
:- Summary "Create a work from a design."
:> Description "..."
:> NamedRoutes (RunAPI (Design n) (WorkId n))
, workIdDesignGet :: mode
:- Summary "Fetch the most recent design on a work."
:> Description "..."
:> WorkId n :> "design" :> NamedRoutes (GetAPI (Design n))
}
deriving (Generic)
```

`stylish-haskell`, of course, will reformat that so each type definition is on a single line, which is what I want in most cases. This would also provide a workaround while waiting on a bug fix (or for me in the case of record GADTs with docs, bug filing!).

```haskell
{- STYLISH ignore -} -- no special highlighting.
{-# STYLISH ignore #-} -- special highlighting, but makes ghc noisy without `-Wno-unrecognized-pragmas`
{-# ANN myDef ("STYLISH ignore" :: String) #-} -- extra special highlighting, but not usable for imports, verbose.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No source files or tests are named. Start by tracing how stylish-haskell formats declarations, then compare the proposed comment, pragma, and annotation markers to determine how an ignored block would be recognized and where it ends. Done means one supported marker prevents reformatting the following block without unwanted compiler warnings, with coverage for the chosen syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.