packages feed

ghc-mod 1.0.6 → 1.0.7

raw patch · 8 files changed

+99/−19 lines, 8 files

Files

+ Flag.hs view
@@ -0,0 +1,10 @@+module Flag where++import DynFlags+import Types++listFlags :: Options -> IO String+listFlags opt = return $ convert opt $+   [ "-f" ++ prefix ++ option+   | (option,_,_) <- fFlags, prefix <- ["","no-"]+   ]
GHCMod.hs view
@@ -11,6 +11,7 @@ import Data.Version import Info import Lang+import Flag import Lint import List import Paths_ghc_mod@@ -31,6 +32,7 @@         ++ "Usage:\n"         ++ "\t ghc-mod list" ++ ghcOptHelp ++ "[-l]\n"         ++ "\t ghc-mod lang [-l]\n"+        ++ "\t ghc-mod flag [-l]\n"         ++ "\t ghc-mod browse" ++ ghcOptHelp ++ "[-l] [-o] <module> [<module> ...]\n"         ++ "\t ghc-mod check" ++ ghcOptHelp ++ "<HaskellFile>\n"         ++ "\t ghc-mod type" ++ ghcOptHelp ++ "<HaskellFile> <module> <expression>\n"@@ -93,11 +95,13 @@       "info"   -> withFile (infoExpr opt (safelist cmdArg 2) (safelist cmdArg 3)) (safelist cmdArg 1)       "lint"   -> withFile (lintSyntax opt)  (safelist cmdArg 1)       "lang"   -> listLanguages opt+      "flag"   -> listFlags opt       "boot"   -> do          mods  <- listModules opt          langs <- listLanguages opt-         pre   <- browseModule opt "Prelude"-         return $ mods ++ langs ++ pre+         flags <- listFlags opt+         pre   <- concat <$> mapM (browseModule opt) preBrowsedModules+         return $ mods ++ langs ++ flags ++ pre       cmd      -> throw (NoSuchCommand cmd)     putStr res   where@@ -134,3 +138,17 @@  toPlain :: [String] -> String toPlain = unlines++----------------------------------------------------------------++preBrowsedModules :: [String]+preBrowsedModules = [+    "Prelude"+  , "Control.Applicative"+  , "Control.Monad"+  , "Control.Exception"+  , "Data.Char"+  , "Data.List"+  , "Data.Maybe"+  , "System.IO"+  ]
elisp/ghc-comp.el view
@@ -48,21 +48,45 @@ (defvar ghc-module-names nil)   ;; completion for "import" (defvar ghc-merged-keyword nil) ;; completion for type/func/... (defvar ghc-language-extensions nil)+(defvar ghc-option-flags nil)+(defvar ghc-pragma-names '("LANGUAGE" "OPTIONS_GHC"))  (defconst ghc-keyword-prefix "ghc-keyword-") (defvar ghc-keyword-Prelude nil)+(defvar ghc-keyword-Control.Applicative nil)+(defvar ghc-keyword-Control.Monad nil)+(defvar ghc-keyword-Control.Exception nil)+(defvar ghc-keyword-Data.Char nil)+(defvar ghc-keyword-Data.List nil)+(defvar ghc-keyword-Data.Maybe nil)+(defvar ghc-keyword-System.IO nil)+ (defvar ghc-loaded-module nil)  (defun ghc-comp-init ()   (let* ((syms '(ghc-module-names-		ghc-language-extensions-		ghc-keyword-Prelude))+		 ghc-language-extensions+		 ghc-option-flags+		 ghc-keyword-Prelude+		 ghc-keyword-Control.Applicative+		 ghc-keyword-Control.Monad+		 ghc-keyword-Control.Exception+		 ghc-keyword-Data.Char+		 ghc-keyword-Data.List+		 ghc-keyword-Data.Maybe+		 ghc-keyword-System.IO)) 	 (vals (ghc-boot (length syms))))     (ghc-set syms vals))   (ghc-add ghc-module-names "qualified")   (ghc-add ghc-module-names "hiding")-  (ghc-add ghc-language-extensions "LANGUAGE")-  (ghc-merge-keywords '("Prelude"))+  (ghc-merge-keywords '("Prelude"+			"Control.Applicative"+			"Control.Monad"+			"Control.Exception"+			"Data.Char"+			"Data.List"+			"Data.Maybe"+			"System.IO"))   (run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer))  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;@@ -172,8 +196,16 @@     ghc-module-names)    ((save-excursion       (beginning-of-line)-      (looking-at "{-#"))+      (looking-at "{-# LANGUAGE "))     ghc-language-extensions)+   ((save-excursion+      (beginning-of-line)+      (looking-at "{-# OPTIONS_GHC "))+    ghc-option-flags)+   ((save-excursion+      (beginning-of-line)+      (looking-at "{-# "))+    ghc-pragma-names)    ((or (bolp) 	(let ((end (point))) 	  (save-excursion
elisp/ghc-func.el view
@@ -94,6 +94,11 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun ghc-things-at-point ()+  (thing-at-point 'sexp))++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+ (defun ghc-keyword-number-pair (spec)   (let ((len (length spec)) key ret)     (dotimes (i len (nreverse ret))
elisp/ghc-info.el view
@@ -20,7 +20,7 @@ 	(ghc-show-type0 ask modname)))))  (defun ghc-show-type0 (ask modname)-  (let* ((expr0 (thing-at-point 'symbol))+  (let* ((expr0 (ghc-things-at-point)) 	 (expr (if ask (ghc-read-expression expr0) expr0)) 	 (cdir default-directory) 	 (file (buffer-name)))@@ -40,7 +40,7 @@ 	(ghc-show-info0 ask modname)))))  (defun ghc-show-info0 (ask modname)-  (let* ((expr0 (thing-at-point 'symbol))+  (let* ((expr0 (ghc-things-at-point)) 	 (expr (if ask (ghc-read-expression expr0) expr0)) 	 (cdir default-directory) 	 (file (buffer-name))
elisp/ghc-ins-mod.el view
@@ -14,7 +14,7 @@   (interactive)   (if (not (ghc-which ghc-hoogle-command))       (message "\"%s\" not found" ghc-hoogle-command)-    (let* ((expr0 (thing-at-point 'symbol))+    (let* ((expr0 (ghc-things-at-point)) 	   (expr (ghc-read-expression expr0)))       (let ((mods (ghc-function-to-modules expr))) 	(if (null mods)@@ -30,17 +30,32 @@ (defun ghc-goto-module-position ()   (goto-char (point-max))   (if (re-search-backward "^import" nil t)-      (forward-line)+      (ghc-goto-empty-line)     (if (re-search-backward "^module" nil t)-	(forward-line)+	(ghc-goto-empty-line)       (goto-char (point-min))))) +(defun ghc-goto-empty-line ()+  (unless (re-search-forward "^$" nil t)+    (forward-line)))++;; To avoid Data.Functor+(defvar ghc-applicative-operators '("<$>" "<$" "<*>" "<**>" "<*" "*>" "<|>"))+ (defun ghc-function-to-modules (fn)+  (if (member fn ghc-applicative-operators)+      '("Control.Applicative")+    (ghc-function-to-modules-hoogle fn)))++(defun ghc-function-to-modules-hoogle (fn)   (with-temp-buffer-    (call-process ghc-hoogle-command nil t nil "search" fn)-    (goto-char (point-min))-    (let ((regex (concat "^\\([a-zA-Z0-9.]+\\) " fn " "))-	  ret)+    (let* ((fn1 (if (string-match "^[a-zA-Z0-9'_]+$" fn)+		    fn+		  (concat "(" fn ")")))+	   (regex (concat "^\\([a-zA-Z0-9.]+\\) " fn1 " "))+	   ret)+      (call-process ghc-hoogle-command nil t nil "search" fn1)+      (goto-char (point-min))       (while (re-search-forward regex nil t) 	(setq ret (cons (match-string 1) ret)))       (nreverse ret))))
elisp/ghc.el view
@@ -16,7 +16,7 @@  ;;; Code: -(defconst ghc-version "1.0.6")+(defconst ghc-version "1.0.7")  ;; (eval-when-compile ;;  (require 'haskell-mode))
ghc-mod.cabal view
@@ -1,5 +1,5 @@ Name:                   ghc-mod-Version:                1.0.6+Version:                1.0.7 Author:                 Kazu Yamamoto <kazu@iij.ad.jp> Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp> License:                BSD3@@ -23,7 +23,7 @@                         ghc-flymake.el ghc-command.el ghc-info.el ghc-ins-mod.el Executable ghc-mod   Main-Is:              GHCMod.hs-  Other-Modules:        List Browse Cabal CabalDev Check Info Lang Lint Types ErrMsg Paths_ghc_mod+  Other-Modules:        List Browse Cabal CabalDev Check Info Lang Flag Lint Types ErrMsg Paths_ghc_mod   if impl(ghc >= 6.12)     GHC-Options:        -Wall -fno-warn-unused-do-bind   else