2014-04-30 01:49:25 +00:00
|
|
|
module Language.Haskell.GhcMod.Boot where
|
2014-04-21 02:57:14 +00:00
|
|
|
|
|
|
|
import Control.Applicative ((<$>))
|
2014-04-30 01:49:25 +00:00
|
|
|
import CoreMonad (liftIO, liftIO)
|
2014-04-21 07:30:31 +00:00
|
|
|
import GHC (Ghc)
|
2014-04-30 01:49:25 +00:00
|
|
|
import Language.Haskell.GhcMod.Browse
|
|
|
|
import Language.Haskell.GhcMod.Flag
|
|
|
|
import Language.Haskell.GhcMod.GHCApi
|
|
|
|
import Language.Haskell.GhcMod.Lang
|
|
|
|
import Language.Haskell.GhcMod.List
|
|
|
|
import Language.Haskell.GhcMod.Types
|
2014-04-21 02:57:14 +00:00
|
|
|
|
2014-04-30 01:51:34 +00:00
|
|
|
-- | Printing necessary information for front-end booting.
|
2014-04-30 01:39:39 +00:00
|
|
|
bootInfo :: Options -> Cradle -> IO String
|
|
|
|
bootInfo opt cradle = withGHC' $ do
|
|
|
|
initializeFlagsWithCradle opt cradle
|
|
|
|
boot opt
|
2014-04-21 02:57:14 +00:00
|
|
|
|
2014-04-30 01:51:34 +00:00
|
|
|
-- | Printing necessary information for front-end booting.
|
2014-04-30 01:39:39 +00:00
|
|
|
boot :: Options -> Ghc String
|
|
|
|
boot opt = do
|
2014-04-21 07:30:31 +00:00
|
|
|
mods <- modules opt
|
|
|
|
langs <- liftIO $ listLanguages opt
|
|
|
|
flags <- liftIO $ listFlags opt
|
2014-04-21 11:36:16 +00:00
|
|
|
pre <- concat <$> mapM (browse opt) preBrowsedModules
|
2014-04-21 07:30:31 +00:00
|
|
|
return $ mods ++ langs ++ flags ++ pre
|
|
|
|
|
2014-04-21 02:57:14 +00:00
|
|
|
preBrowsedModules :: [String]
|
|
|
|
preBrowsedModules = [
|
|
|
|
"Prelude"
|
|
|
|
, "Control.Applicative"
|
|
|
|
, "Control.Exception"
|
|
|
|
, "Control.Monad"
|
|
|
|
, "Data.Char"
|
|
|
|
, "Data.List"
|
|
|
|
, "Data.Maybe"
|
|
|
|
, "System.IO"
|
|
|
|
]
|