From 186485577d4d694bdfd03c3611649516818778b0 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Wed, 30 Apr 2014 10:49:25 +0900 Subject: [PATCH] bootInfo as API. --- Language/Haskell/GhcMod.hs | 2 ++ {src => Language/Haskell/GhcMod}/Boot.hs | 15 ++++++++++----- Language/Haskell/GhcMod/Ghc.hs | 2 ++ ghc-mod.cabal | 9 ++++----- src/GHCMod.hs | 2 -- src/GHCModi.hs | 2 -- 6 files changed, 18 insertions(+), 14 deletions(-) rename {src => Language/Haskell/GhcMod}/Boot.hs (61%) diff --git a/Language/Haskell/GhcMod.hs b/Language/Haskell/GhcMod.hs index bcfd15b..601b6c5 100644 --- a/Language/Haskell/GhcMod.hs +++ b/Language/Haskell/GhcMod.hs @@ -13,6 +13,7 @@ module Language.Haskell.GhcMod ( , ModuleString , Expression -- * 'IO' utilities + , bootInfo , browseModule , checkSyntax , lintSyntax @@ -28,6 +29,7 @@ module Language.Haskell.GhcMod ( , findSymbol ) where +import Language.Haskell.GhcMod.Boot import Language.Haskell.GhcMod.Browse import Language.Haskell.GhcMod.Check import Language.Haskell.GhcMod.Cradle diff --git a/src/Boot.hs b/Language/Haskell/GhcMod/Boot.hs similarity index 61% rename from src/Boot.hs rename to Language/Haskell/GhcMod/Boot.hs index 877eca9..fef19a2 100644 --- a/src/Boot.hs +++ b/Language/Haskell/GhcMod/Boot.hs @@ -1,17 +1,22 @@ -module Boot where +module Language.Haskell.GhcMod.Boot where import Control.Applicative ((<$>)) -import CoreMonad (liftIO) +import CoreMonad (liftIO, liftIO) import GHC (Ghc) -import Language.Haskell.GhcMod -import Language.Haskell.GhcMod.Ghc -import Language.Haskell.GhcMod.Internal +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 +-- | Print necessary information for front-end booting. bootInfo :: Options -> Cradle -> IO String bootInfo opt cradle = withGHC' $ do initializeFlagsWithCradle opt cradle boot opt +-- | Print necessary information for front-end booting. boot :: Options -> Ghc String boot opt = do mods <- modules opt diff --git a/Language/Haskell/GhcMod/Ghc.hs b/Language/Haskell/GhcMod/Ghc.hs index c36c213..1f47599 100644 --- a/Language/Haskell/GhcMod/Ghc.hs +++ b/Language/Haskell/GhcMod/Ghc.hs @@ -3,6 +3,7 @@ module Language.Haskell.GhcMod.Ghc ( withGHC , withGHC' -- * 'Ghc' utilities + , boot , browse , check , info @@ -15,6 +16,7 @@ module Language.Haskell.GhcMod.Ghc ( , lookupSym ) where +import Language.Haskell.GhcMod.Boot import Language.Haskell.GhcMod.Browse import Language.Haskell.GhcMod.Check import Language.Haskell.GhcMod.Find diff --git a/ghc-mod.cabal b/ghc-mod.cabal index f7edb9d..f804771 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -48,7 +48,8 @@ Library Exposed-Modules: Language.Haskell.GhcMod Language.Haskell.GhcMod.Ghc Language.Haskell.GhcMod.Internal - Other-Modules: Language.Haskell.GhcMod.Browse + Other-Modules: Language.Haskell.GhcMod.Boot + Language.Haskell.GhcMod.Browse Language.Haskell.GhcMod.CabalApi Language.Haskell.GhcMod.Check Language.Haskell.GhcMod.Cradle @@ -91,8 +92,7 @@ Library Executable ghc-mod Default-Language: Haskell2010 Main-Is: GHCMod.hs - Other-Modules: Boot - Paths_ghc_mod + Other-Modules: Paths_ghc_mod GHC-Options: -Wall HS-Source-Dirs: src Build-Depends: base >= 4.0 && < 5 @@ -104,8 +104,7 @@ Executable ghc-mod Executable ghc-modi Default-Language: Haskell2010 Main-Is: GHCModi.hs - Other-Modules: Boot - Paths_ghc_mod + Other-Modules: Paths_ghc_mod GHC-Options: -Wall HS-Source-Dirs: src Build-Depends: base >= 4.0 && < 5 diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 5964cf2..98b2563 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -17,8 +17,6 @@ import System.Environment (getArgs) import System.Exit (exitFailure) import System.IO (hPutStr, hPutStrLn, stdout, stderr, hSetEncoding, utf8) -import Boot - ---------------------------------------------------------------- progVersion :: String diff --git a/src/GHCModi.hs b/src/GHCModi.hs index ab5d1f6..aba6609 100644 --- a/src/GHCModi.hs +++ b/src/GHCModi.hs @@ -42,8 +42,6 @@ import System.Directory (setCurrentDirectory) import System.Environment (getArgs) import System.IO (hFlush,stdout) -import Boot - ---------------------------------------------------------------- type Logger = IO String