 
 (add-hook 'haskell-interactive-mode-hook 'sanityinc/no-trailing-whitespace)
 
++
+;; Interaction
+
 (after-load 'haskell-process
   (diminish 'interactive-haskell-mode " IntHS"))
 
 (add-auto-mode 'haskell-mode "\\.ghci\\'")
 
+(when (maybe-require-package 'ghci-completion)
+  (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion))
+
+
++
+;; Indentation
 (require-package 'hi2)
 (add-hook 'haskell-mode-hook 'turn-on-hi2)
+
+(when (fboundp 'electric-indent-mode)
+  (add-hook 'haskell-mode-hook (lambda () (electric-indent-mode -1))))
+
+
++
+;; Source code helpers
 
 (add-hook 'haskell-mode-hook 'haskell-auto-insert-module-template)
 
 (setq-default haskell-stylish-on-save t)
 
+(maybe-require-package 'hayoo)
 (after-load 'haskell-mode
   (define-key haskell-mode-map (kbd "C-c h") 'hoogle)
   (define-key haskell-mode-map (kbd "C-o") 'open-line))
 
-(when (maybe-require-package 'ghci-completion)
-  (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion))
 
-(eval-after-load 'page-break-lines
-  '(push 'haskell-mode page-break-lines-modes))
+(after-load 'page-break-lines
+  (push 'haskell-mode page-break-lines-modes))
 
 ;; Make compilation-mode understand "at blah.hs:11:34-50" lines output by GHC
 (after-load 'compile



(require-package 'haskell-mode)
;; (maybe-require-package 'hayoo)

(add-to-list 'completion-ignored-extensions ".hi")

;;; Flycheck specifics
(when (and (maybe-require-package 'flycheck-haskell)
           (require-package 'flycheck-hdevtools))
  (after-load 'flycheck


    (require 'flycheck-hdevtools)))


;; Docs

(dolist (hook '(haskell-mode-hook inferior-haskell-mode-hook haskell-interactive-mode-hook))
  (add-hook hook 'turn-on-haskell-doc-mode)
