Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#10153 closed feature request (fixed)

GHC mode for converting files to explicit layout

Reported by: ezyang Owned by:
Priority: low Milestone:
Component: Compiler (Parser) Version: 7.11
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


One area where GHC is a little less friendly to newcomers is its Byzantine whitespace layout rules. Once you've gotten used to using GHC you can usually get what you want by abiding certain style, but before then it might be useful to see how GHC is inserting semicolons to your document.

I don't think this would be too hard to do. The idea is to get the token stream and look for virtual curlies with no location. Once you have a list of them, you can go over the original buffer again and insert a brace or semicolon whenever you see a token like this. Might be a good beginner task.

This function would also be useful for debugging layout, since knowing if semicolons are being inserted is useful.

Change History (2)

comment:1 Changed 5 years ago by goldfire

Keywords: newcomer added

Adding "newcomer" keyword as suggested in original post.

comment:2 Changed 4 years ago by ThreeFx

Resolution: fixed
Status: newclosed

Implemented with flag -ddump-parsed.

Version 1, edited 4 years ago by ThreeFx (previous) (next) (diff)
Note: See TracTickets for help on using tickets.