2.1 Problematic symbols

The problem with the NOT symbol is that you would like to use it as an unary prefix operator:

¬(¬x) ≡ x

Unfortunately this is not valid Haskell. The following is:

(¬)((¬)x) ≡ x

But you can hardly call that an improvement over the simple:

not (not x) ≡ x

The problem with the LAMBDA symbol is that it is classified as an alphabetic character, so it can be used as part of a name. See the discussion for GHC.

2.2 New symbol ideas

(please add your own)

I'm thinking of adding the following symbol as another alternative for (*).

Original

Symbol

Code point

Name

(*)

×

U+D7

MULTIPLICATION SIGN

2 * 3 ≡ 6
2 ⋅ 3 ≡ 6
2 × 3 ≡ 6

A disadvantage of this symbol is its similarity to the letter x:

sqr x = x × x

Original

Symbol

Code point

Name

Bool

𝔹

U+1D539

MATHEMATICAL DOUBLE-STRUCK CAPITAL B

This idea is an extension of

type ℕ = Integer

and

type ℚ = Ratio ℕ

The advantage is that it looks nice and that it is a logical extension of ℕ, ℚ and ℝ. The disadvantage is that their is no documented prior use of this character to denote boolean values. This could be detrimental to the readability of code.

To manually enable use M-x set-input-method or C-x RET C-\ with haskell-unicode. Note that the elisp file must be evaluated for this to work.

Now 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 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:

(setq input-method-highlight-flag nil)

Abbrev mode

The Abbrev mode is not suitable since it only deals with words, not operators.

Furthermore, there is a Haskell file type plugin called unicode-haskell which automatically transforms ASCII character sequences (e.g. -> and many others) to Unicode when loading Haskell source code - and the data is converted back when saving. That way, the source code remains plain ASCII on disk but uses nice Unicode characters in vim/gvim. Furthermore, the plugin will automatically replace ASCII sequences with their Unicode equivalents as you type.

The Vim conceal definitions in haskellmode-vim pleasantly mask most of usual symbols with the unicode equivalent but have no effect on the actual source code (in my experience, this is much faster than unicode-haskell and it's much easier to edit). While in normal mode, the concealed characters on the current line will be displayed as ASCII. In insert mode and on lines other than the current one in normal mode, Unicode characters will be displayed.

4.3 SciTE

4.4 Sublime Text 2

Syntax highlighting for the GHC unicode syntax is not supported in the default configuration as of version 2.0.1. However the following patch, when applied to Packages/Haskell/Haskell.tmLanguage, does enable this: https://gist.github.com/3744568

4.5 System wide

m17n input methods

A set of input methods has been written by Urs Holzer for the m17n library. The main goal of Urs is to build input methods for mathematical characters. However, most of the symbols used in the *-unicode-symbols packages can be written using Urs's methods. More information is available at Input Methods for Mathematics page. For most Linux distributions, just download a tarball, extract *.mim files to /usr/share/m17n and enable iBus for input methods.