defining ghc-preferred-modules.
This commit is contained in:
parent
fa0d97cf24
commit
ef266374c0
@ -19,13 +19,25 @@
|
|||||||
(expr (ghc-read-expression expr0)))
|
(expr (ghc-read-expression expr0)))
|
||||||
(ghc-ins-mod expr)))
|
(ghc-ins-mod expr)))
|
||||||
|
|
||||||
|
(defvar ghc-preferred-modules '("Control.Applicative"
|
||||||
|
"Data.ByteString"
|
||||||
|
"Data.Text"
|
||||||
|
"Text.Parsec"))
|
||||||
|
|
||||||
|
(defun ghc-reorder-modules (mods)
|
||||||
|
(catch 'loop
|
||||||
|
(dolist (pmod ghc-preferred-modules)
|
||||||
|
(if (member pmod mods)
|
||||||
|
(throw 'loop (cons pmod (delete pmod mods)))))
|
||||||
|
mods))
|
||||||
|
|
||||||
(defun ghc-ins-mod (expr)
|
(defun ghc-ins-mod (expr)
|
||||||
(let (prefix fun mods)
|
(let (prefix fun mods)
|
||||||
(if (not (string-match "^\\([^.]+\\)\\\.\\([^.]+\\)$" expr))
|
(if (not (string-match "^\\([^.]+\\)\\\.\\([^.]+\\)$" expr))
|
||||||
(setq fun expr)
|
(setq fun expr)
|
||||||
(setq prefix (match-string 1 expr))
|
(setq prefix (match-string 1 expr))
|
||||||
(setq fun (match-string 2 expr)))
|
(setq fun (match-string 2 expr)))
|
||||||
(setq mods (ghc-function-to-modules fun))
|
(setq mods (ghc-reorder-modules (ghc-function-to-modules fun)))
|
||||||
(if (null mods)
|
(if (null mods)
|
||||||
(message "No module guessed")
|
(message "No module guessed")
|
||||||
(let* ((key (or prefix fun))
|
(let* ((key (or prefix fun))
|
||||||
|
Loading…
Reference in New Issue
Block a user