2015-08-28 07:44:20 +00:00
|
|
|
{-# LANGUAGE CPP, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, RankNTypes,
|
2016-01-09 14:27:21 +00:00
|
|
|
StandaloneDeriving, DefaultSignatures, FlexibleInstances, TemplateHaskell,
|
|
|
|
GeneralizedNewtypeDeriving #-}
|
2015-03-11 12:17:24 +00:00
|
|
|
{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-deprecations #-}
|
2015-03-03 20:12:43 +00:00
|
|
|
module Language.Haskell.GhcMod.Types (
|
|
|
|
module Language.Haskell.GhcMod.Types
|
|
|
|
, ModuleName
|
|
|
|
, mkModuleName
|
|
|
|
, moduleNameString
|
|
|
|
) where
|
2010-04-30 09:36:31 +00:00
|
|
|
|
2014-08-28 09:54:01 +00:00
|
|
|
import Control.Monad.Trans.Control (MonadBaseControl)
|
2015-03-03 20:12:43 +00:00
|
|
|
import Control.Monad.Error (Error(..))
|
2015-04-02 23:15:12 +00:00
|
|
|
import qualified Control.Monad.IO.Class as MTL
|
2015-03-03 20:12:43 +00:00
|
|
|
import Control.Exception (Exception)
|
2015-03-28 01:30:51 +00:00
|
|
|
import Control.Applicative
|
2015-08-13 04:47:12 +00:00
|
|
|
import Control.Concurrent
|
2015-08-11 04:35:14 +00:00
|
|
|
import Control.Monad
|
2016-01-09 14:27:21 +00:00
|
|
|
import Control.DeepSeq
|
2015-11-26 14:23:32 +00:00
|
|
|
import Data.Binary
|
2015-11-26 13:48:26 +00:00
|
|
|
import Data.Binary.Generic
|
2015-03-03 20:12:43 +00:00
|
|
|
import Data.Map (Map)
|
|
|
|
import qualified Data.Map as Map
|
|
|
|
import Data.Set (Set)
|
|
|
|
import qualified Data.Set as Set
|
|
|
|
import Data.Monoid
|
2015-03-28 01:30:51 +00:00
|
|
|
import Data.Maybe
|
2015-03-03 20:12:43 +00:00
|
|
|
import Data.Typeable (Typeable)
|
2015-08-11 04:35:14 +00:00
|
|
|
import Data.IORef
|
|
|
|
import Data.Label.Derive
|
2015-08-28 07:44:20 +00:00
|
|
|
import Distribution.Helper hiding (Programs(..))
|
|
|
|
import qualified Distribution.Helper as CabalHelper
|
2014-08-28 09:54:01 +00:00
|
|
|
import Exception (ExceptionMonad)
|
2015-04-02 23:15:12 +00:00
|
|
|
#if __GLASGOW_HASKELL__ < 708
|
|
|
|
import qualified MonadUtils as GHC (MonadIO(..))
|
|
|
|
#endif
|
2015-03-03 20:12:43 +00:00
|
|
|
import GHC (ModuleName, moduleNameString, mkModuleName)
|
2015-08-11 04:35:14 +00:00
|
|
|
import HscTypes (HscEnv)
|
2015-03-28 01:30:51 +00:00
|
|
|
import GHC.Generics
|
2015-08-11 04:35:14 +00:00
|
|
|
import Text.PrettyPrint (Doc)
|
2015-08-03 01:09:56 +00:00
|
|
|
import Prelude
|
2014-04-17 21:40:11 +00:00
|
|
|
|
2015-08-11 04:35:14 +00:00
|
|
|
import Language.Haskell.GhcMod.Caching.Types
|
|
|
|
|
2014-08-28 09:54:01 +00:00
|
|
|
-- | A constraint alias (-XConstraintKinds) to make functions dealing with
|
|
|
|
-- 'GhcModT' somewhat cleaner.
|
|
|
|
--
|
|
|
|
-- Basicially an @IOish m => m@ is a 'Monad' supporting arbitrary 'IO' and
|
|
|
|
-- exception handling. Usually this will simply be 'IO' but we parametrise it in
|
|
|
|
-- the exported API so users have the option to use a custom inner monad.
|
|
|
|
type IOish m = (Functor m, MonadIO m, MonadBaseControl IO m, ExceptionMonad m)
|
2014-08-12 16:08:28 +00:00
|
|
|
|
2015-04-02 23:15:12 +00:00
|
|
|
|
|
|
|
-- MonadUtils of GHC 7.6 or earlier defines its own MonadIO.
|
|
|
|
-- MonadUtils of GHC 7.8 or later imports MonadIO in Monad.Control.IO.Class.
|
|
|
|
#if __GLASGOW_HASKELL__ < 708
|
|
|
|
type MonadIOC m = (GHC.MonadIO m, MTL.MonadIO m)
|
|
|
|
#else
|
|
|
|
type MonadIOC m = (MTL.MonadIO m)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class MonadIOC m => MonadIO m where
|
2015-06-01 14:54:50 +00:00
|
|
|
liftIO :: IO a -> m a
|
2015-04-02 23:15:12 +00:00
|
|
|
|
2013-05-20 05:28:56 +00:00
|
|
|
-- | Output style.
|
2013-09-05 05:35:28 +00:00
|
|
|
data OutputStyle = LispStyle -- ^ S expression style.
|
|
|
|
| PlainStyle -- ^ Plain textstyle.
|
2014-10-22 22:53:41 +00:00
|
|
|
deriving (Show)
|
2012-02-14 01:21:48 +00:00
|
|
|
|
2013-09-05 05:35:28 +00:00
|
|
|
-- | The type for line separator. Historically, a Null string is used.
|
2014-10-22 22:53:41 +00:00
|
|
|
newtype LineSeparator = LineSeparator String deriving (Show)
|
2013-09-03 05:40:51 +00:00
|
|
|
|
2015-08-16 20:20:00 +00:00
|
|
|
data FileMapping = FileMapping {fmPath :: FilePath, fmTemp :: Bool}
|
2016-01-28 21:57:35 +00:00
|
|
|
deriving (Eq, Show)
|
2015-05-31 08:32:46 +00:00
|
|
|
|
|
|
|
type FileMappingMap = Map FilePath FileMapping
|
|
|
|
|
2015-08-28 07:44:20 +00:00
|
|
|
data ProgramSource = ProgramSourceUser | ProgramSourceStack
|
|
|
|
|
|
|
|
data Programs = Programs {
|
|
|
|
-- | @ghc@ program name.
|
|
|
|
ghcProgram :: FilePath
|
|
|
|
-- | @ghc-pkg@ program name.
|
|
|
|
, ghcPkgProgram :: FilePath
|
|
|
|
-- | @cabal@ program name.
|
|
|
|
, cabalProgram :: FilePath
|
|
|
|
-- | @stack@ program name.
|
|
|
|
, stackProgram :: FilePath
|
|
|
|
} deriving (Show)
|
|
|
|
|
2015-08-31 05:33:36 +00:00
|
|
|
data OutputOpts = OutputOpts {
|
|
|
|
-- | Verbosity
|
2015-09-01 08:27:12 +00:00
|
|
|
ooptLogLevel :: GmLogLevel
|
|
|
|
, ooptStyle :: OutputStyle
|
2014-09-18 08:05:47 +00:00
|
|
|
-- | Line separator string.
|
2015-09-01 08:27:12 +00:00
|
|
|
, ooptLineSeparator :: LineSeparator
|
2015-08-13 04:47:12 +00:00
|
|
|
-- | Stdout/err line multiplexing using prefix encoding. @fst@ is stdout,
|
|
|
|
-- @snd@ is stderr prefix.
|
2015-09-01 08:27:12 +00:00
|
|
|
, ooptLinePrefix :: Maybe (String, String)
|
2015-08-31 05:33:36 +00:00
|
|
|
} deriving (Show)
|
|
|
|
|
|
|
|
data Options = Options {
|
2015-09-01 08:27:12 +00:00
|
|
|
optOutput :: OutputOpts
|
|
|
|
, optPrograms :: Programs
|
2014-08-13 16:40:01 +00:00
|
|
|
-- | GHC command line options set on the @ghc-mod@ command line
|
2015-09-01 08:27:12 +00:00
|
|
|
, optGhcUserOptions :: [GHCOption]
|
|
|
|
, optFileMappings :: [(FilePath, Maybe FilePath)]
|
2016-02-09 09:37:56 +00:00
|
|
|
, optEncoding :: String
|
2016-08-24 15:09:29 +00:00
|
|
|
, optStackBuildDeps :: Bool
|
2014-10-22 22:53:41 +00:00
|
|
|
} deriving (Show)
|
2012-02-27 02:23:56 +00:00
|
|
|
|
2013-05-20 05:28:56 +00:00
|
|
|
-- | A default 'Options'.
|
2012-02-27 02:23:56 +00:00
|
|
|
defaultOptions :: Options
|
|
|
|
defaultOptions = Options {
|
2015-09-01 08:27:12 +00:00
|
|
|
optOutput = OutputOpts {
|
|
|
|
ooptLogLevel = GmWarning
|
|
|
|
, ooptStyle = PlainStyle
|
|
|
|
, ooptLineSeparator = LineSeparator "\0"
|
|
|
|
, ooptLinePrefix = Nothing
|
2015-08-31 05:33:36 +00:00
|
|
|
}
|
2015-09-01 08:27:12 +00:00
|
|
|
, optPrograms = Programs {
|
2015-08-28 07:44:20 +00:00
|
|
|
ghcProgram = "ghc"
|
|
|
|
, ghcPkgProgram = "ghc-pkg"
|
|
|
|
, cabalProgram = "cabal"
|
|
|
|
, stackProgram = "stack"
|
|
|
|
}
|
2015-09-01 08:27:12 +00:00
|
|
|
, optGhcUserOptions = []
|
|
|
|
, optFileMappings = []
|
2016-02-09 09:37:56 +00:00
|
|
|
, optEncoding = "UTF-8"
|
2016-08-24 15:09:29 +00:00
|
|
|
, optStackBuildDeps = False
|
2010-04-30 09:36:31 +00:00
|
|
|
}
|
|
|
|
|
2012-02-14 02:33:27 +00:00
|
|
|
----------------------------------------------------------------
|
2012-02-14 07:09:53 +00:00
|
|
|
|
2015-09-11 01:48:52 +00:00
|
|
|
data Project = CabalProject
|
|
|
|
| SandboxProject
|
|
|
|
| PlainProject
|
|
|
|
| StackProject StackEnv
|
2016-02-16 20:44:10 +00:00
|
|
|
deriving (Eq, Show, Ord)
|
2015-09-11 01:48:52 +00:00
|
|
|
|
|
|
|
isCabalHelperProject :: Project -> Bool
|
|
|
|
isCabalHelperProject StackProject {} = True
|
|
|
|
isCabalHelperProject CabalProject {} = True
|
|
|
|
isCabalHelperProject _ = False
|
|
|
|
|
|
|
|
data StackEnv = StackEnv {
|
|
|
|
seDistDir :: FilePath
|
|
|
|
, seBinPath :: [FilePath]
|
|
|
|
, seSnapshotPkgDb :: FilePath
|
|
|
|
, seLocalPkgDb :: FilePath
|
2016-02-16 20:44:10 +00:00
|
|
|
} deriving (Eq, Show, Ord)
|
2015-08-12 07:25:13 +00:00
|
|
|
|
2013-09-05 05:35:28 +00:00
|
|
|
-- | The environment where this library is used.
|
2013-03-02 03:18:55 +00:00
|
|
|
data Cradle = Cradle {
|
2015-09-11 01:48:52 +00:00
|
|
|
cradleProject :: Project
|
2013-09-05 05:35:28 +00:00
|
|
|
-- | The directory where this library is executed.
|
2015-08-12 07:25:13 +00:00
|
|
|
, cradleCurrentDir :: FilePath
|
2014-03-30 08:28:57 +00:00
|
|
|
-- | The project root directory.
|
|
|
|
, cradleRootDir :: FilePath
|
2014-10-14 17:52:58 +00:00
|
|
|
-- | Per-Project temporary directory
|
|
|
|
, cradleTempDir :: FilePath
|
2013-09-05 05:35:28 +00:00
|
|
|
-- | The file name of the found cabal file.
|
2014-03-30 08:28:57 +00:00
|
|
|
, cradleCabalFile :: Maybe FilePath
|
2015-08-18 09:41:14 +00:00
|
|
|
-- | The build info directory.
|
|
|
|
, cradleDistDir :: FilePath
|
2016-02-16 20:44:10 +00:00
|
|
|
} deriving (Eq, Show, Ord)
|
2013-03-02 03:18:55 +00:00
|
|
|
|
2015-09-01 08:27:12 +00:00
|
|
|
data GmStream = GmOutStream | GmErrStream
|
2015-08-13 07:01:58 +00:00
|
|
|
deriving (Show)
|
|
|
|
|
2015-08-11 04:35:14 +00:00
|
|
|
data GhcModEnv = GhcModEnv {
|
|
|
|
gmOptions :: Options
|
|
|
|
, gmCradle :: Cradle
|
2015-09-01 08:27:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
data GhcModOut = GhcModOut {
|
|
|
|
gmoOptions :: OutputOpts
|
2015-09-16 03:08:16 +00:00
|
|
|
, gmoChan :: Chan (Either (MVar ()) (GmStream, String))
|
2015-08-11 04:35:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
data GhcModLog = GhcModLog {
|
|
|
|
gmLogLevel :: Maybe GmLogLevel,
|
|
|
|
gmLogVomitDump :: Last Bool,
|
|
|
|
gmLogMessages :: [(GmLogLevel, String, Doc)]
|
|
|
|
} deriving (Show)
|
|
|
|
|
|
|
|
instance Monoid GhcModLog where
|
|
|
|
mempty = GhcModLog (Just GmPanic) (Last Nothing) mempty
|
|
|
|
GhcModLog ml vd ls `mappend` GhcModLog ml' vd' ls' =
|
|
|
|
GhcModLog (ml' `mplus` ml) (vd `mappend` vd') (ls `mappend` ls')
|
|
|
|
|
|
|
|
data GmGhcSession = GmGhcSession {
|
|
|
|
gmgsSession :: !(IORef HscEnv)
|
|
|
|
}
|
|
|
|
|
|
|
|
data GhcModCaches = GhcModCaches {
|
|
|
|
gmcPackageDbStack :: CacheContents ChCacheData [GhcPkgDb]
|
|
|
|
, gmcMergedPkgOptions :: CacheContents ChCacheData [GHCOption]
|
|
|
|
, gmcComponents :: CacheContents ChCacheData [GmComponent 'GMCRaw ChEntrypoint]
|
|
|
|
, gmcResolvedComponents :: CacheContents
|
|
|
|
[GmComponent 'GMCRaw (Set.Set ModulePath)]
|
|
|
|
(Map.Map ChComponentName (GmComponent 'GMCResolved (Set.Set ModulePath)))
|
|
|
|
}
|
|
|
|
|
|
|
|
data GhcModState = GhcModState {
|
|
|
|
gmGhcSession :: !(Maybe GmGhcSession)
|
|
|
|
, gmCaches :: !GhcModCaches
|
2015-05-31 08:32:46 +00:00
|
|
|
, gmMMappedFiles :: !FileMappingMap
|
2015-08-11 04:35:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defaultGhcModState :: GhcModState
|
|
|
|
defaultGhcModState =
|
2015-12-15 23:23:51 +00:00
|
|
|
GhcModState n (GhcModCaches n n n n) Map.empty
|
2015-08-11 04:35:14 +00:00
|
|
|
where n = Nothing
|
|
|
|
|
2013-03-02 03:18:55 +00:00
|
|
|
----------------------------------------------------------------
|
|
|
|
|
2015-03-04 15:45:26 +00:00
|
|
|
-- | GHC package database flags.
|
2015-08-07 04:47:34 +00:00
|
|
|
data GhcPkgDb = GlobalDb
|
|
|
|
| UserDb
|
|
|
|
| PackageDb String
|
|
|
|
deriving (Eq, Show, Generic)
|
|
|
|
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary GhcPkgDb where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-03-04 15:45:26 +00:00
|
|
|
|
|
|
|
-- | A single GHC command line option.
|
2015-06-01 14:54:50 +00:00
|
|
|
type GHCOption = String
|
2015-03-04 15:45:26 +00:00
|
|
|
|
|
|
|
-- | An include directory for modules.
|
|
|
|
type IncludeDir = FilePath
|
|
|
|
|
|
|
|
-- | Haskell expression.
|
2015-06-01 15:10:37 +00:00
|
|
|
newtype Expression = Expression { getExpression :: String }
|
|
|
|
deriving (Show, Eq, Ord)
|
2015-03-04 15:45:26 +00:00
|
|
|
|
|
|
|
-- | Module name.
|
2015-06-01 15:10:37 +00:00
|
|
|
newtype ModuleString = ModuleString { getModuleString :: String }
|
2016-01-09 14:27:21 +00:00
|
|
|
deriving (Show, Eq, Ord, Binary, NFData)
|
2015-03-04 15:45:26 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
data GmLogLevel =
|
|
|
|
GmSilent
|
|
|
|
| GmPanic
|
|
|
|
| GmException
|
|
|
|
| GmError
|
|
|
|
| GmWarning
|
|
|
|
| GmInfo
|
|
|
|
| GmDebug
|
2015-08-03 06:09:24 +00:00
|
|
|
| GmVomit
|
2015-06-01 14:54:50 +00:00
|
|
|
deriving (Eq, Ord, Enum, Bounded, Show, Read)
|
2013-04-01 05:16:34 +00:00
|
|
|
|
2015-03-03 20:12:43 +00:00
|
|
|
data GmModuleGraph = GmModuleGraph {
|
2015-06-01 14:54:50 +00:00
|
|
|
gmgGraph :: Map ModulePath (Set ModulePath)
|
|
|
|
} deriving (Eq, Ord, Show, Read, Generic, Typeable)
|
2015-03-28 01:30:51 +00:00
|
|
|
|
2015-11-18 19:51:37 +00:00
|
|
|
instance Binary GmModuleGraph where
|
2015-06-01 14:54:50 +00:00
|
|
|
put GmModuleGraph {..} = put (mpim, graph)
|
|
|
|
where
|
|
|
|
mpim :: Map ModulePath Integer
|
|
|
|
mpim = Map.fromList $ Map.keys gmgGraph `zip` [0..]
|
|
|
|
graph :: Map Integer (Set Integer)
|
|
|
|
graph = Map.map (Set.map mpToInt) $ Map.mapKeys mpToInt gmgGraph
|
|
|
|
mpToInt :: ModulePath -> Integer
|
|
|
|
mpToInt mp = fromJust $ Map.lookup mp mpim
|
|
|
|
|
|
|
|
get = do
|
|
|
|
(mpim :: Map ModulePath Integer, graph :: Map Integer (Set Integer)) <- get
|
|
|
|
let impm = swapMap mpim
|
|
|
|
intToMp i = fromJust $ Map.lookup i impm
|
|
|
|
mpGraph :: Map ModulePath (Set ModulePath)
|
|
|
|
mpGraph = Map.map (Set.map intToMp) $ Map.mapKeys intToMp graph
|
|
|
|
return $ GmModuleGraph mpGraph
|
|
|
|
where
|
2016-05-22 00:53:51 +00:00
|
|
|
swapMap :: Ord v => Map k v -> Map v k
|
2015-06-01 14:54:50 +00:00
|
|
|
swapMap = Map.fromList . map (\(x, y) -> (y, x)) . Map.toList
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
instance Monoid GmModuleGraph where
|
2015-06-01 14:54:50 +00:00
|
|
|
mempty = GmModuleGraph mempty
|
|
|
|
mappend (GmModuleGraph a) (GmModuleGraph a') =
|
|
|
|
GmModuleGraph (Map.unionWith Set.union a a')
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-03-28 01:30:51 +00:00
|
|
|
data GmComponentType = GMCRaw
|
|
|
|
| GMCResolved
|
|
|
|
data GmComponent (t :: GmComponentType) eps = GmComponent {
|
2015-06-01 14:54:50 +00:00
|
|
|
gmcHomeModuleGraph :: GmModuleGraph
|
|
|
|
, gmcName :: ChComponentName
|
|
|
|
, gmcGhcOpts :: [GHCOption]
|
|
|
|
, gmcGhcPkgOpts :: [GHCOption]
|
|
|
|
, gmcGhcSrcOpts :: [GHCOption]
|
|
|
|
, gmcGhcLangOpts :: [GHCOption]
|
|
|
|
, gmcRawEntrypoints :: ChEntrypoint
|
|
|
|
, gmcEntrypoints :: eps
|
|
|
|
, gmcSourceDirs :: [FilePath]
|
|
|
|
} deriving (Eq, Ord, Show, Read, Generic, Functor)
|
2015-03-28 01:30:51 +00:00
|
|
|
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary eps => Binary (GmComponent t eps) where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
data ModulePath = ModulePath { mpModule :: ModuleName, mpPath :: FilePath }
|
2015-06-01 14:54:50 +00:00
|
|
|
deriving (Eq, Ord, Show, Read, Generic, Typeable)
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary ModulePath where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-03-28 01:30:51 +00:00
|
|
|
|
2015-11-18 19:51:37 +00:00
|
|
|
instance Binary ModuleName where
|
2015-06-01 14:54:50 +00:00
|
|
|
get = mkModuleName <$> get
|
|
|
|
put mn = put (moduleNameString mn)
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
instance Show ModuleName where
|
2015-06-01 14:54:50 +00:00
|
|
|
show mn = "ModuleName " ++ show (moduleNameString mn)
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
instance Read ModuleName where
|
2015-06-01 14:54:50 +00:00
|
|
|
readsPrec d =
|
|
|
|
readParen
|
|
|
|
(d > app_prec)
|
|
|
|
(\r' -> [ (mkModuleName m, t)
|
|
|
|
| ("ModuleName", s) <- lex r'
|
|
|
|
, (m, t) <- readsPrec (app_prec + 1) s
|
|
|
|
])
|
|
|
|
where
|
|
|
|
app_prec = 10
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
data GhcModError
|
2015-06-01 14:54:50 +00:00
|
|
|
= GMENoMsg
|
|
|
|
-- ^ Unknown error
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
| GMEString String
|
|
|
|
-- ^ Some Error with a message. These are produced mostly by
|
|
|
|
-- 'fail' calls on GhcModT.
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
| GMECabalConfigure GhcModError
|
|
|
|
-- ^ Configuring a cabal project failed.
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-09-15 03:25:29 +00:00
|
|
|
| GMEStackConfigure GhcModError
|
|
|
|
-- ^ Configuring a stack project failed.
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-09-15 03:25:29 +00:00
|
|
|
| GMEStackBootstrap GhcModError
|
|
|
|
-- ^ Bootstrapping @stack@ environment failed (process exited with failure)
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
| GMECabalCompAssignment [(Either FilePath ModuleName, Set ChComponentName)]
|
|
|
|
-- ^ Could not find a consistent component assignment for modules
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-08-31 06:55:49 +00:00
|
|
|
| GMEProcess String String [String] (Either Int GhcModError)
|
2015-06-01 14:54:50 +00:00
|
|
|
-- ^ Launching an operating system process failed. Fields in
|
2015-08-31 06:55:49 +00:00
|
|
|
-- order: function, command, arguments, (stdout, stderr, exitcode)
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
| GMENoCabalFile
|
|
|
|
-- ^ No cabal file found.
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
| GMETooManyCabalFiles [FilePath]
|
|
|
|
-- ^ Too many cabal files found.
|
2015-03-03 20:12:43 +00:00
|
|
|
|
2015-06-01 14:54:50 +00:00
|
|
|
deriving (Eq,Show,Typeable)
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
instance Error GhcModError where
|
2015-06-01 14:54:50 +00:00
|
|
|
noMsg = GMENoMsg
|
|
|
|
strMsg = GMEString
|
2015-03-03 20:12:43 +00:00
|
|
|
|
|
|
|
instance Exception GhcModError
|
|
|
|
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary CabalHelper.Programs where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary ChModuleName where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary ChComponentName where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-11-26 13:48:26 +00:00
|
|
|
instance Binary ChEntrypoint where
|
2015-11-26 14:23:32 +00:00
|
|
|
put = ggput . from
|
|
|
|
get = to `fmap` ggget
|
2015-08-11 04:35:14 +00:00
|
|
|
|
2015-12-07 16:57:33 +00:00
|
|
|
-- | Options for "lintWith" function
|
|
|
|
data LintOpts = LintOpts {
|
|
|
|
optLintHlintOpts :: [String]
|
|
|
|
-- ^ options that will be passed to hlint executable
|
2015-12-20 12:02:31 +00:00
|
|
|
} deriving (Show)
|
2015-12-05 21:56:19 +00:00
|
|
|
|
2015-12-07 16:57:33 +00:00
|
|
|
-- | Default "LintOpts" instance
|
2015-12-05 21:56:19 +00:00
|
|
|
defaultLintOpts :: LintOpts
|
|
|
|
defaultLintOpts = LintOpts []
|
|
|
|
|
2015-12-07 16:57:33 +00:00
|
|
|
-- | Options for "browseWith" function
|
2015-12-05 21:56:19 +00:00
|
|
|
data BrowseOpts = BrowseOpts {
|
|
|
|
optBrowseOperators :: Bool
|
2015-12-07 16:57:33 +00:00
|
|
|
-- ^ If 'True', "browseWith" also returns operators.
|
2015-12-05 21:56:19 +00:00
|
|
|
, optBrowseDetailed :: Bool
|
2015-12-07 16:57:33 +00:00
|
|
|
-- ^ If 'True', "browseWith" also returns types.
|
2016-03-14 18:16:20 +00:00
|
|
|
, optBrowseParents :: Bool
|
|
|
|
-- ^ If 'True', "browseWith" also returns parents.
|
2015-12-05 21:56:19 +00:00
|
|
|
, optBrowseQualified :: Bool
|
2015-12-07 16:57:33 +00:00
|
|
|
-- ^ If 'True', "browseWith" will return fully qualified name
|
2015-12-20 12:02:31 +00:00
|
|
|
} deriving (Show)
|
2015-12-05 21:56:19 +00:00
|
|
|
|
2015-12-07 16:57:33 +00:00
|
|
|
-- | Default "BrowseOpts" instance
|
2015-12-05 21:56:19 +00:00
|
|
|
defaultBrowseOpts :: BrowseOpts
|
2016-03-14 18:16:20 +00:00
|
|
|
defaultBrowseOpts = BrowseOpts False False False False
|
2015-12-05 21:56:19 +00:00
|
|
|
|
2015-08-11 04:35:14 +00:00
|
|
|
mkLabel ''GhcModCaches
|
|
|
|
mkLabel ''GhcModState
|
2015-08-28 07:44:20 +00:00
|
|
|
mkLabel ''Options
|
2015-08-31 05:33:36 +00:00
|
|
|
mkLabel ''OutputOpts
|
2015-08-28 07:44:20 +00:00
|
|
|
mkLabel ''Programs
|