haskellemacsunicodehaskell-mode

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?


Solution

  • 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