Next: , Previous: , Up: Top   [Index]


4 Syntax highlighting

haskell-mode supports syntax highlighting via Emacs’ Font Lock minor mode which should be enabled by default in current Emacsen. See (emacs)Font Lock, for more information on how to control font-lock-mode.

anim/font-lock

Syntax highlighting facilities parse strings and string escape sequences and are able to highlight unrecognized constructs.

anim/string-escape-highlight

Haskell Mode shows keywords, identifiers, operators, constructors and types in different colors.

anim/font-lock-types

There is also support to use mode-specific syntax highlighing for quasiquotes.

anim/font-lock-quasi-quotes

At this point quasi quotes for HTML, XML, shell scripts, Hamlet templates and SQL are supported out of the box. Customize haskell-font-lock-quasi-quote-modes to make sure your quoters are supported.

The following customization variables are responsible for faces applied:

All the above are available for customization.

GHC quasi quote syntax is ambiguous with list comprehension therefore syntax highlighting might get confused with situations like these:

result = [html| html <- htmlList]
result = [html| <html><body>...</body></html> |]

Please use spaces around a list comprehension variable to make this unambiguous. Any of the following will work:

result = [ html| html <- htmlList]
result = [html | html <- htmlList]

GHC’s ambiguity is an accident of the past but it is unlikely to be fixed due to backward compatibility baggage.


Next: , Previous: , Up: Top   [Index]