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

Let pretty printing use OverloadedStrings #409

Merged
merged 1 commit into from
May 19, 2016
Merged

Let pretty printing use OverloadedStrings #409

merged 1 commit into from
May 19, 2016

Conversation

EliasC
Copy link
Contributor

@EliasC EliasC commented May 11, 2016

This commit refactors the pretty printing of C and Encore ASTs, mainly
by using OverloadedStrings. This GHC extension lets you use string literals
where another String like data-type is expected. The pretty printers
work with the type Doc, meaning we had to write text "*" when we
wanted a literal "*". Now, the string literal is enough. Also cleaned up
parts of the code and made the emacs mode more resilent to change.

"bool"
"char"
"int"
"string"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that string has been deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and we still give a warning when using that type! When it's completely removed from the compiler, the emacs-mode could also drop it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...on second thought, maybe the Emacs mode shouldn't encourage using string if it's deprecated!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to rebase anyway, so I'll remove this in the process.

@kikofernandez
Copy link
Contributor

apart from those two small comments, I am merging this as soon as it is rebased

This commit refactors the pretty printing of C and Encore ASTs, mainly
by using [OverloadedStrings](https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/basic-syntax-extensions#overloadedstrings). This GHC extension lets you use string literals
where another `String` like data-type is expected. The pretty printers
work with the type `Doc`, meaning we had to write `text "*"` when we
wanted a literal `"*"`. Now, the string literal is enough. Also cleaned up
parts of the code and made the emacs mode more resilent to change.
@EliasC
Copy link
Contributor Author

EliasC commented May 19, 2016

Fixed and rebased!

@kikofernandez
Copy link
Contributor

Merging in 15 min

@kikofernandez kikofernandez merged commit 548c1cd into parapluu:development May 19, 2016
@kikofernandez kikofernandez deleted the refactoring/overloaded-strings branch May 19, 2016 13:30
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