Brittany doesn't generate blank lines for do {stmts;;;stmts}
#270
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#270
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?
Hi, I'm generating Haskell code with braces and semi-colons and then using brittany to remove braces and semicolons and use braces instead.
I'm trying to figure out how to generate code so that after brittany processes it there will be spaces between things. I've tried
; ;
,; ;
,\n; \n;
. In all cases, brittany consumes the extra;
(and the newline) and generates lines with no space between them.Any idea how I can generate
do { stmts; <something>; stmts}
and getout?
I'm very curious why this is your workflow. It seems very non-standard and rather a niche issue.
I have a C++ program that translates a simple input language into Haskell and then runs it in a special interpreter that tracks execution traces, in order to implement probabilistic programming.
BTW, my recollection (I think from the Haskell 2010 report) was that the reason Haskell handles layout by translating whitespace to
{
.;
. and}
is precisely so that Haskell can be machine-generated. I'm not sure generation of Haskell code in general is "very non-standard".I have two questions. First, does the implementation ignore all blank lines inside a
{
}
block? Second, what kind of work would be required to handle blank lines like this?Hmm, it seems that brittany will preserve whitespace before comments. So both the whitespace and the comment are preserved below.
Aha! You are right. I had not thought of that use case until you mentioned it.
in the AST looks like
So this involves somehow turning
AnnSemiSep
s into newlines. Either by pre-processing on the annotations or by treating it like an "after-element-comment" that consists only of newlines.@bredelings please test if the semicolon-newlines branch works for you (you will need to enable the new config flag in addition to running that branch).
Indeed, it works! I added the line
lconfig_experimentalSemicolonNewlines: true
to the config.implemented in 0.12.1.1