 (require-package 'haskell-mode)
-(maybe-require-package 'hayoo)
+
++
+;; Completion
 
 (add-to-list 'completion-ignored-extensions ".hi")
 
-;;; Flycheck specifics
+;; Hook auto-complete into the completions provided by the inferior
+;; haskell process, if any.
+
+(require-package 'ac-haskell-process)
+
+(add-hook 'interactive-haskell-mode-hook 'ac-haskell-process-setup)
+(add-hook 'haskell-interactive-mode-hook 'ac-haskell-process-setup)
+
+(after-load 'haskell-mode
+  (define-key haskell-mode-map (kbd "C-c C-d") 'ac-haskell-process-popup-doc))
+
+(after-load 'auto-complete
+  (add-to-list 'ac-modes 'haskell-interactive-mode)
+  (add-hook 'haskell-interactive-mode-hook 'set-auto-complete-as-completion-at-point-function))
+
+
++
+;; Flycheck specifics
+
 (when (and (maybe-require-package 'flycheck-haskell)
            (require-package 'flycheck-hdevtools))
   (after-load 'flycheck


(add-hook 'haskell-interactive-mode-hook 'sanityinc/no-trailing-whitespace)

(after-load 'haskell-process
  (diminish 'interactive-haskell-mode " IntHS"))

(add-auto-mode 'haskell-mode "\\.ghci\\'")

(require-package 'hi2)
(add-hook 'haskell-mode-hook 'turn-on-hi2)

(add-hook 'haskell-mode-hook 'haskell-auto-insert-module-template)

(setq-default haskell-stylish-on-save t)

(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))

;; Make compilation-mode understand "at blah.hs:11:34-50" lines output by GHC
(after-load 'compile


    (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)
