diff --git a/contrib/lang/haskell/README.md b/contrib/lang/haskell/README.md
index 61b316edc..7fce07587 100644
--- a/contrib/lang/haskell/README.md
+++ b/contrib/lang/haskell/README.md
@@ -89,19 +89,25 @@ Note that `emacs.app` for OS X does not pick up `$PATH` from `~/.bashrc` or
`~/.zshrc` when launched from outside a terminal.
### Optional extras
-The Haskell layer supports some extra features that can be enabled through layer variables.
+The Haskell layer supports some extra features that can be enabled through
+layer variables.
#### GHCi-ng support
-[ghci-ng][] adds some nice features to `haskell-mode`, and is supported in Spacemacs by a layer variable:
+[ghci-ng][] adds some nice features to `haskell-mode`, and is supported in
+Spacemacs by a layer variable:
-Follow the instructions to install [ghci-ng][] (remember to add `:set +c` in `~/.ghci`,
-next set the layer variable:
+Follow the instructions to install [ghci-ng][] (remember to add `:set +c`
+in `~/.ghci`, next set the layer variable:
```elisp
;; List of configuration layers to load.
-dotspacemacs-configuration-layers '(company-mode (haskell :variables haskell-enable-ghci-ng-support t) git)
+dotspacemacs-configuration-layers
+'(company-mode
+ git
+ (haskell :variables haskell-enable-ghci-ng-support t))
```
-Once ghci-ng is enabled, two of the old keybindings are overriden with improved versions from ghci-ng, and a new keybinding available:
+Once ghci-ng is enabled, two of the old keybindings are overriden with improved
+versions from ghci-ng, and a new keybinding available:
Key Binding | Description
----------------------|------------------------------------------------------------
@@ -110,19 +116,37 @@ Once ghci-ng is enabled, two of the old keybindings are overriden with improved
SPC m u | finds uses of identifier
#### structured-haskell-mode
-[structured-haskell-mode][], or shm, replaces hi2 and adds some nice functionality.
-To enable shm, run `cabal install structured-haskell-mode` and set the layer variable:
+[structured-haskell-mode][], or shm, replaces hi2 (and any other
+Haskell-indentation modes) and adds some nice functionality.
+To enable shm, run `cabal install structured-haskell-mode` and set the layer
+variable:
```elisp
;; List of configuration layers to load.
dotspacemacs-configuration-layers '(company-mode (haskell :variables haskell-enable-shm-support t) git)
```
+After shm has been enabled, some of the evil normal-mode bindings are overridden:
+
+ Key Binding | Description
+----------------------|------------------------------------------------------------
+D | `shm/kill-line`
+R | `shm/raise`
+P | `shm/yank`
+( | `shm/forward-node`
+) | `shm/backward-node`
+
+For a nice visualization of these functions, please refer to the github page
+for [structured-haskell-mode][].
+
#### hindent
[hindent]() is an extensible Haskell pretty printer, which let's you
reformat your code. You need to install the executable with `cabal
install hindent`; to enable it set:
```elisp
;; List of configuration layers to load.
-dotspacemacs-configuration-layers '(company-mode (haskell :variables haskell-enable-hindent-support t) git)
+dotspacemacs-configuration-layers
+ '(company-mode
+ git
+ (haskell :variables haskell-enable-hindent-support t))
```
By default it uses the style called `fundamental`, if you want to use
another, `johan-tibell`, run `M-x customize-variable
diff --git a/contrib/lang/haskell/packages.el b/contrib/lang/haskell/packages.el
index eb4fae2b3..4b298d08c 100644
--- a/contrib/lang/haskell/packages.el
+++ b/contrib/lang/haskell/packages.el
@@ -24,14 +24,49 @@
(defun haskell/init-flycheck ()
(add-hook 'haskell-mode-hook 'flycheck-mode)
- (add-hook 'flycheck-mode-hook 'flycheck-haskell-setup))
+ (add-hook 'flycheck-mode-hook 'flycheck-haskell-setup)
+ (setq flycheck-display-errors-delay 0))
(defun haskell/init-shm ()
(use-package shm
:defer t
:if haskell-enable-shm-support
:init
- (add-hook 'haskell-mode-hook 'structured-haskell-mode)))
+ (add-hook 'haskell-mode-hook 'structured-haskell-mode)
+ :config
+ (progn
+ (when (require 'shm-case-split nil 'noerror)
+ ;;TODO: Find some better bindings for case-splits
+ (define-key shm-map (kbd "C-c S") 'shm/case-split)
+ (define-key shm-map (kbd "C-c C-s") 'shm/do-case-split))
+
+ (evil-define-key 'normal shm-map
+ (kbd "RET") nil
+ (kbd "C-k") nil
+ (kbd "C-j") nil
+ (kbd "D") 'shm/kill-line
+ (kbd "R") 'shm/raise
+ (kbd "P") 'shm/yank
+ (kbd "RET") 'shm/newline-indent
+ (kbd "RET") 'shm/newline-indent
+ (kbd "M-RET") 'evil-ret
+ )
+
+ (evil-define-key 'operator map
+ (kbd ")") 'shm/forward-node
+ (kbd "(") 'shm/backward-node
+ )
+
+ (evil-define-key 'motion map
+ (kbd ")") 'shm/forward-node
+ (kbd "(") 'shm/backward-node
+ )
+
+ (define-key shm-map (kbd "C-j") nil)
+ (define-key shm-map (kbd "C-k") nil)
+ )
+ )
+ )
(defun haskell/init-hindent ()
(use-package hindent
@@ -41,6 +76,7 @@
(add-hook 'haskell-mode-hook #'hindent-mode)
:config
(progn
+ (setq hindent-style "chris-done")
(evil-leader/set-key-for-mode 'haskell-mode
"mF" 'hindent/reformat-decl))))
@@ -161,18 +197,7 @@
(if (not haskell-enable-shm-support)
(turn-on-haskell-indentation)
)
-
- ;; Indent the below lines on columns after the current column.
- ;; Might need better bindings for spacemacs and OS X
- (define-key haskell-mode-map (kbd "C-")
- (lambda ()
- (interactive)
- (haskell-move-nested 1)))
- ;; Same as above but backwards.
- (define-key haskell-mode-map (kbd "C-")
- (lambda ()
- (interactive)
- (haskell-move-nested -1))))
+ )
;; Useful to have these keybindings for .cabal files, too.
(defun haskell-cabal-hook ()