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


5 Unicode support

See the Haskell Wiki’s entry on Unicode Symbols for general information about Unicode support in Haskell.

As Emacs supports editing files containing Unicode out of the box, so does Haskell Mode. As an add-on, Haskell Mode includes the haskell-unicode input method which allows you to easily type a number of Unicode symbols that are useful when writing Haskell code; See (emacs)Input Methods, for more details.

To automatically enable the haskell-unicode input method in haskell-mode buffers use M-x customize-variable RET haskell-mode-hook or put the following code in your .emacs file:

(add-hook 'haskell-mode-hook 'turn-on-haskell-unicode-input-method)

To temporarily enable this input method for a single buffer you can use M-x turn-on-haskell-unicode-input-method.

When the haskell-unicode input method is active, you can simply type ‘->’ and it is immediately replaced with ‘’. Use C-\ to toggle the input method. To see a table of all key sequences use M-x describe-input-method RET haskell-unicode. A sequence like ‘<=’ is ambiguous and can mean either ‘’ or ‘’. Typing it presents you with a choice. Type 1 or 2 to select an option or keep typing to use the default option.

If you don’t like the highlighting of partially matching tokens you can turn it off by setting input-method-highlight-flag to nil via M-x customize-variable.