Support formatting over TypeOperators #271
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#271
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?
Currently, running brittany over the below file:
... results in the below error:
Note that when the definition of
type Foo
is just a single line brittany doesn't seem to mind.Concretely, this is an issue for me in Servant API type definitions, which can get lengthy.
With
--output-on-errors
you can see the source of the issue.Looks like there is some in progress work here.
https://github.com/lspitzner/brittany/blob/master/src/Language/Haskell/Brittany/Internal/Layouters/Type.hs#L473-L532
FYI, that was reached with the
--dump-ast-unknown
flag.The main problem seems to be the presence of newlines.
briDocByExactInlineOnly
is being used, which explodes if newlines exist in the AST. So your code above fails, but this works.If you can't omit newlines as a work around, I'd recommend using
-- brittany-disable-next-binding
to disable formatting on that statement in the meantime.I just bumped into this and made a simple test case. Interestingly moving this comma to the next line is enough to stop this happening :/
This may be another good fit for https://github.com/lspitzner/brittany/issues/28 (passthrough for unhandled constructs)
@expipiplus1 Thanks for the hint! #28 was in fact implemented by now. So on current master, the effect of this not being fully supported yet is much more limited.
Great!
I think I'm experiencing the same issue with
servant
here.https://github.com/theam/aws-lambda-haskell-runtime/blob/master/examples/wai-app/src/Lib.hs#L60-L66
Any news related to this issue? Is there any help required? This issue actually blocks from using
brittany
on production projects and unfortunately forces to switch toormolu
without such a problems, but with an alien formatting style instead.I'm closing this in favor of #241, which I think is the same thing.