branch: elpa/haskell-ts-mode commit 15c68f92965e31b33432dc5c3231ac953412180a Author: Pranshu Sharma <pranshusharma...@gmail.com> Commit: Pranshu Sharma <pranshusharma...@gmail.com>
README changed --- README.org | 23 +++++++++++++++++++++++ haskell-ts-mode.el | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/README.org b/README.org index 129f773f6f..4baf9c8e2b 100644 --- a/README.org +++ b/README.org @@ -1,10 +1,30 @@ +* Context + A haskell mode that requires treesitter and offers: - Syntax highliting - Indentation - Imenu support - REPL +- Prettify symbols mode support + +* Motivation + +haskell-mode contains nearly 30k lines of code, and is +about 30 years old. Therefore, a lot of stuff emacs has gained the +ability to do in those years, haskell-mode already has implemented +them. + +In 2018, a mode called haskell-tng-mode was made to solve some of +these problems. However because of haskell's syntax, it too became +very complex and required a web of dependencies. +Both these modes ended up practically parsing haskells syntax to +implement indentation, so I thought why not use tree sitter? + +However, haskell(-tng)-mode is still a lot more complete than this, +and is recommended if you have any commercial work to do. + * Installation #+BEGIN_SRC: elisp @@ -18,3 +38,6 @@ if colour is too much or too less for you, adjust treesit-font-lock-level accordingly. If that is not enough, you can customize haskell-ts-font-lock-feature-list + +* TODO +- support for customization UI diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el index 3c0dc6e443..917cab35ea 100644 --- a/haskell-ts-mode.el +++ b/haskell-ts-mode.el @@ -44,6 +44,10 @@ (match keyword) (otherwise))) +(defvar haskell-ts-prettify-symbols-alits + '(("\\" . "λ") + ("/=" . "≠"))) + ;; TODO change to defvar (defvar haskell-ts-font-lock (treesit-font-lock-rules @@ -204,6 +208,7 @@ (list (cons ?` ?`) (cons ?( ?)) (cons ?{ ?}) (cons ?" ?") (cons ?[ ?]))) (setq-local treesit-defun-name-function 'haskell-ts-defun-name) (setq-local treesit-defun-type-regexp "function") + (setq-local prettify-symbols-alist haskell-ts-prettify-symbols-alist) ;; Imenu (setq-local treesit-simple-imenu-settings `((nil haskell-ts-imenu-func-node-p nil