Skip to content
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

More pretty printing fixes #477

Merged
merged 2 commits into from
Oct 28, 2020
Merged

Conversation

tomsmeding
Copy link
Member

@tomsmeding tomsmeding commented Oct 27, 2020

Description
This fixes some more of my reported issues in #470. I believe these fixes work; I've tested them on small examples (including those in #470).

The semicolon change doesn't seem to be necessary for Alet, since it appears those are never put on one line.

Motivation and context
See #470 and #476.

How has this been tested?
See above; only minimalistically.

Types of changes
What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist
Go over all the following points, and put an x in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Previously, something like the following:
  map (\a -> let b = a * a ; c = b * b in T2 c (T3 a b c)) (use (fromList Z [1 :: Float]))
would pretty print as:
  map (\x0 -> let x1 = x0 * x0 x2 = x1 * x1 in T2 x2 (T3 x0 x1 x2)) (use (Scalar Z [1.0]))

With this change, it is now printed as:
  map (\x0 -> let x1 = x0 * x0 ; x2 = x1 * x1 in T2 x2 (T3 x0 x1 x2)) (use (Scalar Z [1.0]))
which is better.
This is not _necessary_ so much for prettyTuple and prettyAtuple, but
it's very much wanted for prettyLhs, because it makes the code closer to
parseable Haskell. Without the 'align' there, the arguments to the T<n>
sometimes came on the same indentation level as the constructor, meaning
they're seen as declarations in the Let due to layout rules -- which
doesn't parse.
@tmcdonell tmcdonell merged commit c18f925 into AccelerateHS:master Oct 28, 2020
@tomsmeding tomsmeding deleted the pprint-fixes-2 branch October 31, 2020 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants