Skip to content

Instantly share code, notes, and snippets.

@mgsloan
Created November 20, 2014 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgsloan/3449f72a2918628a4906 to your computer and use it in GitHub Desktop.
Save mgsloan/3449f72a2918628a4906 to your computer and use it in GitHub Desktop.
Github haskell highlighting issues

Hello!

Github is awesome! However, a minor issue report:

Very recently the code highlighting changed, to the detriment of haskell highlighting. Others have noticed too, an example comment: https://github.com/chrisdone/hindent/issues/36#issuecomment-63157052

The old highlighting doesn't need to come back, however, here are a couple immediately apparent issues:

  1. The last type in a function type signature seems to get a different color, for no good reason

  2. The function name in a type signature gets a different color, for no good reason

  3. It's really jarring to see name qualifiers specially highlighted. This is especially true as this color is also used for types and "builtins"

  4. On the topic of "builtins", highlighting functions like "show" and "read" as being special is very un-haskelley. There should be no pretending that these words are actually special, as they could refer to anything. They should be highlighted the same as any identifier.

  5. Special highlighting of operators would be appreciated, as paying attention to all the operators in an expression is important for understanding its structure. One thing to consider here is that it may be worthwhile to distinguish builtin operators, such as (=), (::), (~), (->), and (<-)

Finally, for bonus points, the following would be amazing, but probably too much work:

Have highlighting distinguish between the value level and the type level. So we'd end up with all of the following as different colors:

  • Type variables
  • Type constructors
  • Type operators
  • Value variables
  • Value constructors
  • Value operators

Probably distinguishing type and value operators is overkill, but the other 4 are interesting to handle.

@fernandezseb
Copy link

A simple and solid solution would be to color code according to the structure defined by the Haskell standard e.g. https://www.haskell.org/onlinereport/lexemes.html.

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