-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to print curly brace if it doesn't fit? #628
Comments
Ohhh I can use
Man this stuff takes me ages to get my head around. I've literally been staring at it for hours. |
Wait no I'm being dumb. That will always add the |
Well this does it although it uses private stuff. Is there a better way?
|
This is a good solution. Flatly was not directly exposed because it can break the invariants. It only makes sense for certain pairs of Docs. For instance if you flatten the resulting Doc should have lines as long or longer, not shorter. That said, I think you .orEmpty combinator is safe and doesn't break invariants. However, composing two such as you have done should only be done with a .grouped (the whole thing flattens or not at all) so a comment should be made around the method. If you would make a PR I'd be happy to review and I think we could merge it. |
So then I think
Are you suggesting a PR for just |
I would like to do:
if it fits, otherwise do:
Is this possible?
Seems like I need
FlatAlt("{" +: Doc.hardLine, doc)
but there is no way to create a customFlatAlt
.The text was updated successfully, but these errors were encountered: