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

syntax highlighting stops after using list comprehension #176

Closed
Da-Viper opened this issue Nov 6, 2020 · 2 comments
Closed

syntax highlighting stops after using list comprehension #176

Da-Viper opened this issue Nov 6, 2020 · 2 comments

Comments

@Da-Viper
Copy link

Da-Viper commented Nov 6, 2020

for example something like this to get the above average numbers

aboveAverage :: (Ord a, Fractional a) => a -> a -> a -> Int
aboveAverage x y z  = length [a| a <- [x,y,z], a > average x y z ]

after a code like this syntax highlighting does not work anymore

@sheaf
Copy link
Collaborator

sheaf commented Nov 6, 2020

Hi, thanks for the bug report.

The problem is that quasi-quotation syntax and list comprehension syntax ambiguously overlap. This means you have to write list comprehension syntax using spaces:

length [ a | a <- [x,y,z], a > average x y z ]

You'll notice the syntax highlighting that GitHub uses exhibits the same issue:

length [a| a <- [x,y,z], a > average x y z ]

f :: x -> x
f a = a -- this isn't highlighted because the above list comprehension is interpreted as a quasi-quote which has not been terminated

@sheaf sheaf changed the title syntax highlighting stops after using list comprehension with length syntax highlighting stops after using list comprehension Nov 6, 2020
@sheaf sheaf pinned this issue Nov 6, 2020
@sheaf sheaf closed this as completed Nov 6, 2020
@Da-Viper
Copy link
Author

Da-Viper commented Nov 6, 2020

@sheaf thanks it fixed it just started learning haskell and i have not heard of the former

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants