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

Haskell prime breaks highlighting #1514

Closed
Fresheyeball opened this issue May 12, 2020 · 2 comments · Fixed by #1524
Closed

Haskell prime breaks highlighting #1514

Fresheyeball opened this issue May 12, 2020 · 2 comments · Fixed by #1524
Assignees
Labels
bugfix-request A request for a bugfix to be developed.

Comments

@Fresheyeball
Copy link

Fresheyeball commented May 12, 2020

Describe the bug
In the Haskell language the ' character may be used in a variable name, and frequently is (pronounced "prime").

foo :: Int -> Int
foo x' = x' + 1

This case causes the highlighting to treat the entire rest of the file as a giant string, since there is no closing '.

Other use cases for ' appear to work, including describing a Char

letterC :: Char
letterC = 'C'

and promoted types

data Foo = Bar
toUnit :: Proxy 'Bar -> ()
toUnit _ = ()

but not in variable names.

To Reproduce
This effect can be seen in this file here:
https://gitlab.com/fresheyeball/Shpadoinkle/-/blob/master/examples/servant-crud/View.hs#L77

Expected behavior
The single tick is not treated as the start of a string. Note the syntax highlighting is correct on GitHub, which does not use Rouge. Here is the same file in a gist for comparison:
https://gist.github.com/Fresheyeball/495f2f68718cc1a539a00b7d36a4e4fd

@Fresheyeball Fresheyeball added the bugfix-request A request for a bugfix to be developed. label May 12, 2020
@Fresheyeball Fresheyeball changed the title Haskell DataKinds breaks highlighting Haskell prime breaks highlighting May 12, 2020
@pyrmont pyrmont self-assigned this May 12, 2020
@pyrmont
Copy link
Contributor

pyrmont commented May 12, 2020

@Fresheyeball When ' is used to describe a Char, are the number of characters used in the source code always 1? Can you, for example, have this:

newline :: Char
newline = '\n'

@Fresheyeball
Copy link
Author

@pyrmont the newline char example you posted is legal Haskell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix-request A request for a bugfix to be developed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants