Patterns synonyms removal from export list after formatting #367

Open
opened 2022-03-13 11:58:15 +01:00 by anpryl · 0 comments
anpryl commented 2022-03-13 11:58:15 +01:00 (Migrated from github.com)

According to docs we can add pattern synonyms to export list, but brittany removes it.

Test file:

{-# 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:

{-# 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

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
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 ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#367
There is no content yet.