Rorschach
Rorschach

Reputation: 32416

emacs haskell-unicode-input-method in haskell-mode convert unicode back to ascii

I just started using haskell-mode for emacs and am using turn-on-haskell-unicode-input-method, a function that converts various expressions to unicode equivalents in the haskell-mode buffers. I was surprised to find that the ascii values are permanently replaced by the unicode characters, so when trying to load into ghci REPL there are errors. I like the unicode though, and am looking for a quick fix that converts the unicode back to ascii when saving/sending to REPL. Is there an easy way to do this?

Upvotes: 2

Views: 550

Answers (2)

Stefan
Stefan

Reputation: 28521

If you don't want Unicode characters in your files, then rather than an input-method, you want some "pretty display" functionality. I think haskell-mode has a haskell-font-lock-symbols option for that. Emacs-24.4 also introduced a similar (but global) prettify-symbols-mode feature for that purpose, but I don't know if haskell-mode supports it already.

Upvotes: 1

Jason Robinson
Jason Robinson

Reputation: 945

After enabling haskell mode, you can add the following snippet to your .emacs file.

;; Unicode symbols
(defvar haskell-font-lock-symbols)
(setq haskell-font-lock-symbols t)

You will be able to see the symbols, and GHC will interpret your source as a normal .hs file.

You can also check the Haskell Wiki for more information

Upvotes: 2

Related Questions