error formatting semicolon do notation which contains a let and in #181
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#181
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?
Please excuse my haskell, but I am learning.
I just starting using brittany, thank you so much for this tool, I really appreciate it :)
I get an error on the following code:
This code has no problem
And neither does this
which makes me suspect the problem is in reformatting the
dowith curlies, which contains aletandinThis is low priority, since I can fix the code myself, but I thought I'd report it anyway.
thanks for reporting.
minimal, currently broken testcase for this is
which i suppose we want to be layouted exactly like that (?)
Two approaches:
Fix the layouter for
let..into not assume that the indentation ofletandinis always allowed to be the sameRewrite the syntax-tree to
Both of which have annoying downsides, afaict.
On a related note, I just noticed that supporting brace style is more complex than I had expected, because
is not valid haskell. But that is a different topic.
@awalterschulze would you be opposed to 2), or see downsides to it? (my objection is mostly philosophical, in that it would be a first where brittany actually changed the shape of the AST. And the effect on handling of comments during the transformation will probably be tricky.)
I thought the minimally broken test case was with curly braces
And the break happens, because brittany rewrites all curly brace do notations to space based do notations.
I wouldn't mind either way, as long as brittany does not give an error.
But I did find that when I was using the curly brace style, I never wanted to write the
inin the first place, I needed to, since as you say, it is not possible to write it without theinSo personally I would prefer 2, but it is rewriting it to space based do notation, which allows you to not write
in.On the other hand, maybe removing
inis more of a thing thathlintshould recommend.both testcases are valid. both are valid haskell, and are currently transformed into (the same) non-valid haskell by brittany.
yeah, that matches my reservation.
I'll give this a bit of time, perhaps someone can think of a better alternative. But it should definitely be fixed.