{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
module Development.IDE.Core.RuleTypes(
module Development.IDE.Core.RuleTypes
) where
import Control.DeepSeq
import Data.Binary
import Development.IDE.Import.DependencyInformation
import Development.IDE.GHC.Compat
import Development.IDE.GHC.Util
import Data.Hashable
import Data.Typeable
import qualified Data.Set as S
import Development.Shake
import GHC.Generics (Generic)
import Module (InstalledUnitId)
import HscTypes (hm_iface, CgGuts, Linkable, HomeModInfo, ModDetails)
import Development.IDE.Spans.Type
import Development.IDE.Import.FindImports (ArtifactsLocation)
import Data.ByteString (ByteString)
type instance RuleResult GetParsedModule = ParsedModule
type instance RuleResult GetDependencyInformation = DependencyInformation
type instance RuleResult GetDependencies = TransitiveDependencies
data TcModuleResult = TcModuleResult
{ tmrModule :: TypecheckedModule
, tmrModInfo :: HomeModInfo
}
instance Show TcModuleResult where
show = show . pm_mod_summary . tm_parsed_module . tmrModule
instance NFData TcModuleResult where
rnf = rwhnf
tmrModSummary :: TcModuleResult -> ModSummary
tmrModSummary = pm_mod_summary . tm_parsed_module . tmrModule
data HiFileResult = HiFileResult
{ hirModSummary :: !ModSummary
, hirModIface :: !ModIface
}
tmr_hiFileResult :: TcModuleResult -> HiFileResult
tmr_hiFileResult tmr = HiFileResult modSummary modIface
where
modIface = hm_iface . tmrModInfo $ tmr
modSummary = tmrModSummary tmr
hiFileFingerPrint :: HiFileResult -> ByteString
hiFileFingerPrint = fingerprintToBS . getModuleHash . hirModIface
instance NFData HiFileResult where
rnf = rwhnf
instance Show HiFileResult where
show = show . hirModSummary
type instance RuleResult TypeCheck = TcModuleResult
type instance RuleResult GetSpanInfo = SpansInfo
type instance RuleResult GenerateCore = (SafeHaskellMode, CgGuts, ModDetails)
type instance RuleResult GenerateByteCode = Linkable
type instance RuleResult GhcSession = HscEnvEq
type instance RuleResult GhcSessionDeps = HscEnvEq
type instance RuleResult GetLocatedImports = ([(Located ModuleName, Maybe ArtifactsLocation)], S.Set InstalledUnitId)
type instance RuleResult ReportImportCycles = ()
type instance RuleResult GetModIfaceFromDisk = HiFileResult
type instance RuleResult GetModIface = HiFileResult
type instance RuleResult IsFileOfInterest = Bool
type instance RuleResult GetModSummary = ModSummary
type instance RuleResult GetModSummaryWithoutTimestamps = ModSummary
data GetParsedModule = GetParsedModule
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetParsedModule
instance NFData GetParsedModule
instance Binary GetParsedModule
data GetLocatedImports = GetLocatedImports
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetLocatedImports
instance NFData GetLocatedImports
instance Binary GetLocatedImports
data GetDependencyInformation = GetDependencyInformation
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetDependencyInformation
instance NFData GetDependencyInformation
instance Binary GetDependencyInformation
data ReportImportCycles = ReportImportCycles
deriving (Eq, Show, Typeable, Generic)
instance Hashable ReportImportCycles
instance NFData ReportImportCycles
instance Binary ReportImportCycles
data GetDependencies = GetDependencies
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetDependencies
instance NFData GetDependencies
instance Binary GetDependencies
data TypeCheck = TypeCheck
deriving (Eq, Show, Typeable, Generic)
instance Hashable TypeCheck
instance NFData TypeCheck
instance Binary TypeCheck
data GetSpanInfo = GetSpanInfo
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetSpanInfo
instance NFData GetSpanInfo
instance Binary GetSpanInfo
data GenerateCore = GenerateCore
deriving (Eq, Show, Typeable, Generic)
instance Hashable GenerateCore
instance NFData GenerateCore
instance Binary GenerateCore
data GenerateByteCode = GenerateByteCode
deriving (Eq, Show, Typeable, Generic)
instance Hashable GenerateByteCode
instance NFData GenerateByteCode
instance Binary GenerateByteCode
data GhcSession = GhcSession
deriving (Eq, Show, Typeable, Generic)
instance Hashable GhcSession
instance NFData GhcSession
instance Binary GhcSession
data GhcSessionDeps = GhcSessionDeps deriving (Eq, Show, Typeable, Generic)
instance Hashable GhcSessionDeps
instance NFData GhcSessionDeps
instance Binary GhcSessionDeps
data GetModIfaceFromDisk = GetModIfaceFromDisk
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetModIfaceFromDisk
instance NFData GetModIfaceFromDisk
instance Binary GetModIfaceFromDisk
data GetModIface = GetModIface
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetModIface
instance NFData GetModIface
instance Binary GetModIface
data IsFileOfInterest = IsFileOfInterest
deriving (Eq, Show, Typeable, Generic)
instance Hashable IsFileOfInterest
instance NFData IsFileOfInterest
instance Binary IsFileOfInterest
data GetModSummaryWithoutTimestamps = GetModSummaryWithoutTimestamps
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetModSummaryWithoutTimestamps
instance NFData GetModSummaryWithoutTimestamps
instance Binary GetModSummaryWithoutTimestamps
data GetModSummary = GetModSummary
deriving (Eq, Show, Typeable, Generic)
instance Hashable GetModSummary
instance NFData GetModSummary
instance Binary GetModSummary