Formatting removes key program components in custom data structures #368
Labels
No Label
blocked: dependency
blocked: info-needed
bug
duplicate
enhancement
fixed in HEAD
help wanted
hs:arrows
hs:brackets
hs:classes
hs:comments
hs:do-notation
hs:guards
hs:lists
hs:operators
hs:patterns
hs:records
hs:types
invalid
language extension support
layouting
needs confirmation
priority: high
priority: low
question
revisit before next release
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: hexagoxel/brittany#368
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
See below of the before and after of running
brittany --config-file=brittany.yaml --write-mode=inplace $(git ls-files '*.hs')
using the default config on versions 0.14.0.0, and 0.14.0.2.As is evident, the code produced is completely unable to compile.
Dang, that's a gnarly bug! Unfortunately Brittany only barely supports GADTs. See #217, #242, and #261 for some other examples.
I managed to resist putting "catastrophic reformatting on data structures" as the title, cause yeah this is bad lol.
Is there anywhere in particular in the code where this could be solved? I'm not familiar with formatters.
This is currently preventing us from using brittany after we upgrade to LTS-19, so I did a little digging...
GADTs trigger this formatting line in
Internal.Layouters.DataDecl.layoutDataDecl
:so I thought maybe this was an issue in
ghc-exactprint
, made a little harness that uses exactprint to parse & print a GADT but I get the proper output back:logging out the
ltycl
in that case branch(withbriDocByExactNoComment $ traceShow (showSDocUnsafe $ ppr ltycl) $ ltycl
via new test file I wrote) gives us:So I'm inclined to believe the problem lies somewhere within
briDocByExactNoComment
, but I haven't dug much further than that yet.