 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Company integration (auto-completion)
 
+(defconst intero-pragmas
+  '("CONLIKE" "SCC" "DEPRECATED" "INCLUDE" "INCOHERENT" "INLINABLE" "INLINE"
+    "LANGUAGE" "LINE" "MINIMAL" "NOINLINE" "NOUNPACK" "OPTIONS" "OPTIONS_GHC"
+    "OVERLAPPABLE" "OVERLAPPING" "OVERLAPS" "RULES" "SOURCE" "SPECIALIZE"
+    "UNPACK" "WARNING")
+  "Pragmas that GHC supports.")
+
 (defun company-intero (command &optional arg &rest ignored)
   (interactive (list 'interactive))
   (cl-case command

            (setq type 'haskell-completions-general-prefix))
          (when value (list start end value type)))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ELDoc integration


       (let ((prefix-info (intero-completions-grab-prefix)))
         (when prefix-info
           (cl-destructuring-bind
               (beg end prefix type) prefix-info
             (or (cl-case type
                   (haskell-completions-module-name-prefix
                    (intero-get-repl-completions (concat "import " prefix)))
                   (haskell-completions-identifier-prefix
                    (intero-get-completions beg end))
                   (haskell-completions-language-extension-prefix
                    (mapcar (lambda (x)
                              (replace-regexp-in-string "^-X" "" x))
                            (intero-get-repl-completions (concat ":set -X" prefix))))
                   (haskell-completions-pragma-name-prefix
                    (cl-remove-if-not
                     (lambda (candidate)
                       (string-match (concat "^" prefix) candidate))
                     intero-pragmas)))
                 (intero-get-repl-completions prefix)))))))))

(defun intero-completions-grab-prefix (&optional minlen)
  "Grab prefix at point for possible completion."
  (when (intero-completions-can-grab-prefix)
    (let ((prefix (cond
                   ((intero-completions-grab-pragma-prefix))
                   ((intero-completions-grab-identifier-prefix)))))
      (cond ((and minlen prefix)
             (when (>= (length (nth 2 prefix)) minlen)
