Fix warnings

This commit is contained in:
Daniel Gröber 2014-05-09 20:38:35 +02:00
parent 44b897c6a5
commit 175635505d
4 changed files with 14 additions and 20 deletions

View File

@ -13,21 +13,16 @@ module Language.Haskell.GhcMod.CabalApi (
import Language.Haskell.GhcMod.Types import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.GhcPkg import Language.Haskell.GhcMod.GhcPkg
import Language.Haskell.GhcMod.CabalConfig import Language.Haskell.GhcMod.CabalConfig
import Language.Haskell.GhcMod.Utils
import Control.Applicative ((<$>)) import Control.Applicative ((<$>))
import Control.Exception (SomeException(..))
import qualified Control.Exception as E import qualified Control.Exception as E
import Control.Monad (filterM,mplus) import Control.Monad (filterM)
import CoreMonad (liftIO) import CoreMonad (liftIO)
import Data.Maybe (maybeToList) import Data.Maybe (maybeToList)
import Data.Set (fromList, toList) import Data.Set (fromList, toList)
import Data.List (find,tails,isPrefixOf,nub,stripPrefix)
import Distribution.ModuleName (ModuleName,toFilePath) import Distribution.ModuleName (ModuleName,toFilePath)
import Distribution.Package (Dependency(Dependency) import Distribution.Package (Dependency(Dependency)
, PackageName(PackageName) , PackageName(PackageName))
, InstalledPackageId(..)
, PackageIdentifier)
import qualified Distribution.Package as C import qualified Distribution.Package as C
import Distribution.PackageDescription (PackageDescription, BuildInfo, TestSuite, TestSuiteInterface(..), Executable) import Distribution.PackageDescription (PackageDescription, BuildInfo, TestSuite, TestSuiteInterface(..), Executable)
import qualified Distribution.PackageDescription as P import qualified Distribution.PackageDescription as P
@ -36,16 +31,12 @@ import Distribution.PackageDescription.Parse (readPackageDescription)
import Distribution.Simple.Compiler (CompilerId(..), CompilerFlavor(..)) import Distribution.Simple.Compiler (CompilerId(..), CompilerFlavor(..))
import Distribution.Simple.Program (ghcProgram) import Distribution.Simple.Program (ghcProgram)
import Distribution.Simple.Program.Types (programName, programFindVersion) import Distribution.Simple.Program.Types (programName, programFindVersion)
import Distribution.Simple.BuildPaths (defaultDistPref)
import Distribution.Simple.Configure (localBuildInfoFile)
import Distribution.Simple.LocalBuildInfo (ComponentName)
import Distribution.System (buildPlatform) import Distribution.System (buildPlatform)
import Distribution.Text (display) import Distribution.Text (display)
import Distribution.Verbosity (silent) import Distribution.Verbosity (silent)
import Distribution.Version (Version) import Distribution.Version (Version)
import System.Directory (doesFileExist) import System.Directory (doesFileExist)
import System.FilePath ((</>)) import System.FilePath ((</>))
import Text.Read (readMaybe)
---------------------------------------------------------------- ----------------------------------------------------------------
-- | Getting necessary 'CompilerOptions' from three information sources. -- | Getting necessary 'CompilerOptions' from three information sources.

View File

@ -13,15 +13,13 @@ import qualified Language.Haskell.GhcMod.Cabal18 as C18
import qualified Control.Exception as E import qualified Control.Exception as E
import Control.Applicative ((<$>)) import Control.Applicative ((<$>))
import Control.Monad (filterM,mplus) import Control.Monad (mplus)
import Control.Monad.Error () import Control.Monad.Error ()
import Data.Maybe () import Data.Maybe ()
import Data.Set () import Data.Set ()
import Data.List (find,tails,isPrefixOf,isInfixOf,nub,stripPrefix) import Data.List (find,tails,isPrefixOf,isInfixOf,nub,stripPrefix)
import Distribution.Package (PackageName(PackageName) import Distribution.Package (InstalledPackageId(..)
, InstalledPackageId(..)
, PackageIdentifier) , PackageIdentifier)
import qualified Distribution.Package as C
import Distribution.Simple.BuildPaths (defaultDistPref) import Distribution.Simple.BuildPaths (defaultDistPref)
import Distribution.Simple.Configure (localBuildInfoFile) import Distribution.Simple.Configure (localBuildInfoFile)
import Distribution.Simple.LocalBuildInfo (ComponentName) import Distribution.Simple.LocalBuildInfo (ComponentName)

View File

@ -15,7 +15,6 @@ import Control.Applicative ((<$>))
#if MIN_VERSION_Cabal(1,18,0) #if MIN_VERSION_Cabal(1,18,0)
import Control.Exception (SomeException(..)) import Control.Exception (SomeException(..))
#endif #endif
import qualified Control.Exception as E
import Data.Char (isSpace) import Data.Char (isSpace)
import Data.List (isPrefixOf, intercalate) import Data.List (isPrefixOf, intercalate)
import Data.List.Split (splitOn) import Data.List.Split (splitOn)
@ -52,11 +51,12 @@ getPackageDbStack :: FilePath -- ^ Project Directory (where the
-- cabal.sandbox.config file would be if it -- cabal.sandbox.config file would be if it
-- exists) -- exists)
-> IO [GhcPkgDb] -> IO [GhcPkgDb]
getPackageDbStack cdir =
#if MIN_VERSION_Cabal(1,18,0) #if MIN_VERSION_Cabal(1,18,0)
getPackageDbStack cdir =
(getSandboxDb cdir >>= \db -> return [GlobalDb, PackageDb db]) (getSandboxDb cdir >>= \db -> return [GlobalDb, PackageDb db])
`E.catch` \(_ :: SomeException) -> return [GlobalDb, UserDb] `E.catch` \(_ :: SomeException) -> return [GlobalDb, UserDb]
#else #else
getPackageDbStack _ =
return [GlobalDb, UserDb] return [GlobalDb, UserDb]
#endif #endif

View File

@ -23,11 +23,17 @@ import GhcMonad
import Exception import Exception
import MonadUtils import MonadUtils
import DynFlags import DynFlags
-- ghc <= 7.2
import Data.Monoid (Monoid)
#if !MIN_VERSION_ghc(7,4,0) #if !MIN_VERSION_ghc(7,4,0)
import HscTypes import HscTypes
#endif #endif
-- base <= 4.6
#if !MIN_VERSION_base(4,7,0)
import Data.Monoid (Monoid)
import Control.Monad.Trans.Class (lift)
#endif
import Data.IORef (IORef, readIORef, writeIORef, newIORef) import Data.IORef (IORef, readIORef, writeIORef, newIORef)
import Control.Monad (liftM) import Control.Monad (liftM)
@ -36,7 +42,6 @@ import Control.Monad.Base (MonadBase,liftBase)
import Control.Monad.Trans.RWS.Lazy (RWST(..),runRWST) import Control.Monad.Trans.RWS.Lazy (RWST(..),runRWST)
import Control.Monad.Trans.Control (MonadBaseControl(..), StM, liftBaseWith import Control.Monad.Trans.Control (MonadBaseControl(..), StM, liftBaseWith
, control, liftBaseOp, liftBaseOp_) , control, liftBaseOp, liftBaseOp_)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Reader.Class import Control.Monad.Reader.Class
import Control.Monad.Writer.Class import Control.Monad.Writer.Class
import Control.Monad.State.Class import Control.Monad.State.Class