lspitzner / lspitzner/brittany

Patterns synonyms removal from export list after formatting

Open
#367 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Haskell
Stars
686
Forks
69
PR merge metrics
No merged PRs in 30d

Description

According to [docs](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/pattern_synonyms.html#import-and-export-of-pattern-synonyms) we can add pattern synonyms to export list, but brittany removes it.

Test file:
```haskell
{-# LANGUAGE PatternSynonyms #-}

module Import.Audit.Category.SubjectScheme
( X (.., XA, XB, XC)
)
where

data X
= A String
| B Int
| C

pattern XA, XB, XC :: X
pattern XA = A "some_string"
pattern XB = B 3
pattern XC = C
```

Output:
```haskell
{-# LANGUAGE PatternSynonyms #-}

module Import.Audit.Category.SubjectScheme
( X(..)
) where

data X
= A String
| B Int
| C

pattern XA, XB, XC :: X
pattern XA = A "some_string"
pattern XB = B 3
pattern XC = C
```

brittany.yaml
```yaml
conf_disable_formatting: false
conf_forward:
options_ghc:
- -XPatternSynonyms
- -XLambdaCase
- -XMultiWayIf
- -XGADTs
- -XPatternGuards
- -XViewPatterns
- -XRecursiveDo
- -XTupleSections
- -XExplicitForAll
- -XImplicitParams
- -XQuasiQuotes
- -XTemplateHaskell
- -XBangPatterns
- -XTypeApplications
conf_obfuscate: false
conf_layout:
lconfig_reformatModulePreamble: true
lconfig_altChooser:
contents: 3
tag: AltChooserBoundedSearch
lconfig_allowSingleLineExportList: false
lconfig_hangingTypeSignature: false
lconfig_allowHangingQuasiQuotes: true
lconfig_indentListSpecial: true
lconfig_alignmentBreakOnMultiline: true
lconfig_experimentalSemicolonNewlines: false
lconfig_cols: 80
lconfig_columnAlignMode:
contents: 0.7
tag: ColumnAlignModeMajority
lconfig_importColumn: 50
lconfig_importAsColumn: 50
lconfig_alignmentLimit: 30
lconfig_indentAmount: 2
lconfig_indentPolicy: IndentPolicyFree
lconfig_indentWhereSpecial: true
conf_debug:
dconf_dump_bridoc_simpl_par: false
dconf_dump_config: false
dconf_dump_bridoc_raw: false
dconf_dump_bridoc_simpl_floating: false
dconf_dump_bridoc_simpl_alt: false
dconf_dump_bridoc_simpl_indent: false
dconf_dump_annotations: false
dconf_dump_bridoc_simpl_columns: false
dconf_dump_ast_full: false
dconf_roundtrip_exactprint_only: false
dconf_dump_ast_unknown: false
dconf_dump_bridoc_final: false
conf_errorHandling:
econf_ExactPrintFallback: ExactPrintFallbackModeInline
econf_Werror: false
econf_omit_output_valid_check: false
econf_produceOutputOnErrors: false
conf_preprocessor:
ppconf_CPPMode: CPPModeAbort
ppconf_hackAroundIncludes: false
conf_roundtrip_exactprint_only: false
conf_version: 1
```

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 with the supplied Haskell reproducer and the linked GHC pattern-synonyms documentation, then review brittany.yaml for the formatting configuration used. Run the formatter on the example and compare its export list with the expected output. Done means the pattern synonyms remain in the formatted export list.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.