imports Data.ByteString, System.FilePath, and System.Directory at booting.

This commit is contained in:
Kazu Yamamoto 2014-04-08 13:56:33 +09:00
parent 69ec168c7b
commit 02af334b94
2 changed files with 31 additions and 6 deletions

View File

@ -30,7 +30,7 @@ unloaded modules are loaded")
;; must be sorted ;; must be sorted
(defconst ghc-reserved-keyword '("case" "deriving" "do" "else" "if" "in" "let" "module" "of" "then" "where")) (defconst ghc-reserved-keyword '("case" "deriving" "do" "else" "if" "in" "let" "module" "of" "then" "where"))
(defconst ghc-extra-keywords '("ByteString")) (defconst ghc-extra-keywords '()) ;; was '("ByteString")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
@ -56,11 +56,14 @@ unloaded modules are loaded")
(defconst ghc-keyword-prefix "ghc-keyword-") (defconst ghc-keyword-prefix "ghc-keyword-")
(defvar ghc-keyword-Prelude nil) (defvar ghc-keyword-Prelude nil)
(defvar ghc-keyword-Control.Applicative nil) (defvar ghc-keyword-Control.Applicative nil)
(defvar ghc-keyword-Control.Monad nil)
(defvar ghc-keyword-Control.Exception nil) (defvar ghc-keyword-Control.Exception nil)
(defvar ghc-keyword-Control.Monad nil)
(defvar ghc-keyword-Data.ByteString nil)
(defvar ghc-keyword-Data.Char nil) (defvar ghc-keyword-Data.Char nil)
(defvar ghc-keyword-Data.List nil) (defvar ghc-keyword-Data.List nil)
(defvar ghc-keyword-Data.Maybe nil) (defvar ghc-keyword-Data.Maybe nil)
(defvar ghc-keyword-System.Directory nil)
(defvar ghc-keyword-System.FilePath nil)
(defvar ghc-keyword-System.IO nil) (defvar ghc-keyword-System.IO nil)
(defvar ghc-loaded-module nil) (defvar ghc-loaded-module nil)
@ -73,11 +76,14 @@ unloaded modules are loaded")
;; hard coded in GHCMod.hs ;; hard coded in GHCMod.hs
ghc-keyword-Prelude ghc-keyword-Prelude
ghc-keyword-Control.Applicative ghc-keyword-Control.Applicative
ghc-keyword-Control.Monad
ghc-keyword-Control.Exception ghc-keyword-Control.Exception
ghc-keyword-Control.Monad
ghc-keyword-Data.ByteString
ghc-keyword-Data.Char ghc-keyword-Data.Char
ghc-keyword-Data.List ghc-keyword-Data.List
ghc-keyword-Data.Maybe ghc-keyword-Data.Maybe
ghc-keyword-System.Directory
ghc-keyword-System.FilePath
ghc-keyword-System.IO)) ghc-keyword-System.IO))
(vals (ghc-boot (length syms)))) (vals (ghc-boot (length syms))))
(ghc-set syms vals)) (ghc-set syms vals))
@ -86,11 +92,14 @@ unloaded modules are loaded")
;; hard coded in GHCMod.hs ;; hard coded in GHCMod.hs
(ghc-merge-keywords '("Prelude" (ghc-merge-keywords '("Prelude"
"Control.Applicative" "Control.Applicative"
"Control.Monad"
"Control.Exception" "Control.Exception"
"Control.Monad"
"Data.ByteString"
"Data.Char" "Data.Char"
"Data.List" "Data.List"
"Data.Maybe" "Data.Maybe"
"System.Directory"
"System.FilePath"
"System.IO")) "System.IO"))
(run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer)) (run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer))

View File

@ -120,7 +120,8 @@ main = flip E.catches handlers $ do
mods <- listModules opt cradle mods <- listModules opt cradle
langs <- listLanguages opt langs <- listLanguages opt
flags <- listFlags opt flags <- listFlags opt
pre <- concat <$> mapM (browseModule opt cradle) preBrowsedModules let opt' = addPackages opt
pre <- concat <$> mapM (browseModule opt' cradle) preBrowsedModules
return $ mods ++ langs ++ flags ++ pre return $ mods ++ langs ++ flags ++ pre
"help" -> return $ O.usageInfo usage argspec "help" -> return $ O.usageInfo usage argspec
cmd -> E.throw (NoSuchCommand cmd) cmd -> E.throw (NoSuchCommand cmd)
@ -160,10 +161,25 @@ preBrowsedModules :: [String]
preBrowsedModules = [ preBrowsedModules = [
"Prelude" "Prelude"
, "Control.Applicative" , "Control.Applicative"
, "Control.Monad"
, "Control.Exception" , "Control.Exception"
, "Control.Monad"
, "Data.ByteString"
, "Data.Char" , "Data.Char"
, "Data.List" , "Data.List"
, "Data.Maybe" , "Data.Maybe"
, "System.Directory"
, "System.FilePath"
, "System.IO" , "System.IO"
] ]
preBrowsePackages :: [String]
preBrowsePackages = [
"bytestring"
, "directory"
, "filepath"
]
addPackages :: Options -> Options
addPackages opt = opt { ghcOpts = pkgs ++ ghcOpts opt}
where
pkgs = map ("-package " ++) preBrowsePackages