tvl-depot/emacs/.emacs.d/wpc/wpc-haskell.el
William Carroll 3dac2f10ff Drop support for Haskell glyphs
I think that glyphs look nice, but they subtley confuse Emacs's UI. In the case
of a two-character glyph condensing into one character's width, the fill-width
indicator -- correctly -- highlights the 81st character as red, but it looks
like it's erroneously highlighting the 80th.

Also when I want to create an anonymous function I type (), which condenses into
the unit character, and it's difficult to delete either the opening or the
closing parenthesis.

Overall I think glyphs are cute, but they're not worth the trouble.
2020-04-11 10:41:49 +01:00

51 lines
1.4 KiB
EmacsLisp

;;; haskell.el --- My Haskell preferences -*- lexical-binding: t -*-
;; Author: William Carroll <wpcarro@gmail.com>
;;; Commentary:
;; Hosts my Haskell development preferences
;;; Code:
;; Haskell support
;; font-locking, glyph support, etc
(use-package haskell-mode
:config
(add-hook-before-save 'haskell-mode #'haskell-align-imports))
;; LSP support
(use-package lsp-haskell
:after (haskell-mode)
:config
(setq lsp-haskell-process-path-hie "hie-wrapper")
(add-hook 'haskell-mode-hook #'lsp-haskell-enable)
(add-hook 'haskell-mode-hook #'flycheck-mode))
;; Test toggling
(defun haskell/module->test ()
"Jump from a module to a test."
(let ((filename (->> buffer-file-name
(s-replace "/src/" "/test/")
(s-replace ".hs" "Test.hs")
find-file)))
(make-directory (f-dirname filename) t)
(find-file filename)))
(defun haskell/test->module ()
"Jump from a test to a module."
(let ((filename (->> buffer-file-name
(s-replace "/test/" "/src/")
(s-replace "Test.hs" ".hs")
)))
(make-directory (f-dirname filename) t)
(find-file filename)))
(defun haskell/test<->module ()
"Toggle between test and module in Haskell."
(interactive)
(if (s-contains? "/src/" buffer-file-name)
(haskell/module->test)
(haskell/test->module)))
(provide 'wpc-haskell)
;;; wpc-haskell.el ends here