Add instance formatting, defaulting to ExactPrint in places #187
No reviewers
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#187
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "master"
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?
Format typeclass instances, defaulting to ExactPrint for the instance head and type/data family instances. The results from type/data family instances contain newlines/indentation that is stripped using
Text
processing. This was easier than writing a full formatter for those instances, but should be checked carefully and replaced soon.Relevant to #17
Not commenting on code quality, but I've run this on Freckle and commented here:
https://github.com/lspitzner/brittany/issues/17#issuecomment-428694848
I ran this against the ITProTV codebase and it looks great! It correctly formatted all our instances, nothing else changed, and everything still built 😄
Thanks, looks good!
(travis failure is probably a false positive - travis still chokes on the "run tests in parallel" change merged recently. thought i had that resolved, will have to have another look.)
Rg
stripWhitespace'
: Yeah, its a bit hacky, but fine by me. I understand somewhat why exactprint behaves this way, but it is more annoying than useful. Either way, this is a temporary solution anyways (until brittany learns to layout data/type decls). I have pushed a commit that adds a stupidly long explanation, and I have refactored the implementation to be a tad shorter and to avoid any partial functions (Text.init/tail). I am mildly certain that I have not changed semantics, but if you want to make sure you can run tests again (@tfausak).This is ready to merge, but I will wait for feedback, if you have any.
The changes to
stripWhitespace'
look good to me, especially removing partial functions. Just waiting on a positive test result from @tfausak or @eborden!Tests passed! I formatted our entire codebase using Brittany at commit
6dc5561d08
and ran the tests to establish a baseline. Then I re-formatted using commit38216cdc02
. Everything worked!👍 from me.