inserting a module for type.

This commit is contained in:
Kazu Yamamoto 2014-03-25 22:05:33 +09:00
parent a16dc3d040
commit f97cc2e096
2 changed files with 8 additions and 4 deletions

View File

@ -171,6 +171,9 @@
(if (not (bolp)) (insert "\n"))) (if (not (bolp)) (insert "\n")))
(insert (match-string 1) " = undefined\n"))) (insert (match-string 1) " = undefined\n")))
;; GHC 7.8 uses Unicode for single-quotes. ;; GHC 7.8 uses Unicode for single-quotes.
((string-match "Not in scope: type constructor or class `\\([^'\n\0]+\\)'" data)
(let ((sym (match-string 1 data)))
(ghc-ins-mod sym)))
((string-match "Not in scope: `\\([^'\n\0]+\\)'" data) ((string-match "Not in scope: `\\([^'\n\0]+\\)'" data)
(let ((sym (match-string 1 data))) (let ((sym (match-string 1 data)))
(if (y-or-n-p (format "Import module for %s?" sym)) (if (y-or-n-p (format "Import module for %s?" sym))
@ -193,7 +196,7 @@
(delete-region (point) end)) (delete-region (point) end))
(insert new)))) (insert new))))
(t (t
(message "Nothing is done")))))) (message "Nothing was done"))))))
(defun ghc-extract-type (str) (defun ghc-extract-type (str)
(with-temp-buffer (with-temp-buffer

View File

@ -200,8 +200,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ghc-enclose (expr) (defun ghc-enclose (expr)
(if (string-match "^[a-zA-Z0-9_]$" expr) (let ((case-fold-search nil))
expr (if (string-match "^[a-zA-Z0-9_]" expr)
(concat "(" expr ")"))) expr
(concat "(" expr ")"))))
(provide 'ghc-func) (provide 'ghc-func)