ghcide-2.7.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Import.FindImports

Synopsis

- locateModule :: MonadIO m => HscEnv -> [(UnitId, DynFlags)] -> [String] -> (ModuleName -> NormalizedFilePath -> m (Maybe NormalizedFilePath)) -> Located ModuleName -> PkgQual -> Bool -> m (Either [FileDiagnostic] Import)
- locateModuleFile :: MonadIO m => [(UnitId, [FilePath], Set ModuleName)] -> [String] -> (ModuleName -> NormalizedFilePath -> m (Maybe NormalizedFilePath)) -> Bool -> ModuleName -> m LocateResult
- data Import
  - = FileImport !ArtifactsLocation
  - | PackageImport
- data ArtifactsLocation = ArtifactsLocation {
  - artifactFilePath :: !NormalizedFilePath
  - artifactModLocation :: !(Maybe ModLocation)
  - artifactIsSource :: !Bool
  - artifactModule :: !(Maybe Module)
  }
- modSummaryToArtifactsLocation :: NormalizedFilePath -> Maybe ModSummary -> ArtifactsLocation
- isBootLocation :: ArtifactsLocation -> Bool
- mkImportDirs :: HscEnv -> (UnitId, DynFlags) -> Maybe (UnitId, ([FilePath], Set ModuleName))

# Documentation

locateModule #

Arguments

:: MonadIO m |
=> HscEnv |
-> [(UnitId, DynFlags)] | Import directories
-> [String] | File extensions
-> (ModuleName -> NormalizedFilePath -> m (Maybe NormalizedFilePath)) | does file exist predicate
-> Located ModuleName | Module name
-> PkgQual | Package name
-> Bool | Is boot module
-> m (Either [FileDiagnostic] Import) |

locate a module in either the file system or the package database. Where we go from *daml to Haskell

locateModuleFile :: MonadIO m => [(UnitId, [FilePath], Set ModuleName)] -> [String] -> (ModuleName -> NormalizedFilePath -> m (Maybe NormalizedFilePath)) -> Bool -> ModuleName -> m LocateResult #

locate a module in the file system. Where we go from *daml to Haskell

data Import #

Constructors

FileImport !ArtifactsLocation |
PackageImport |

#### Instances

Instances details

Show Import # |
Instance details Defined in Development.IDE.Import.FindImports Methods showsPrec :: Int -> Import -> ShowS # show :: Import -> String # showList :: [Import] -> ShowS #
NFData Import # |
Instance details Defined in Development.IDE.Import.FindImports Methods rnf :: Import -> () #

data ArtifactsLocation #

Constructors

ArtifactsLocation |

Fields

- artifactFilePath :: !NormalizedFilePath
- artifactModLocation :: !(Maybe ModLocation)
- artifactIsSource :: !Bool

  True if a module is a source input

- artifactModule :: !(Maybe Module)

#### Instances

Instances details

Show ArtifactsLocation # |
Instance details Defined in Development.IDE.Import.FindImports Methods showsPrec :: Int -> ArtifactsLocation -> ShowS # show :: ArtifactsLocation -> String # showList :: [ArtifactsLocation] -> ShowS #
NFData ArtifactsLocation # |
Instance details Defined in Development.IDE.Import.FindImports Methods rnf :: ArtifactsLocation -> () #

modSummaryToArtifactsLocation :: NormalizedFilePath -> Maybe ModSummary -> ArtifactsLocation #

isBootLocation :: ArtifactsLocation -> Bool #

mkImportDirs :: HscEnv -> (UnitId, DynFlags) -> Maybe (UnitId, ([FilePath], Set ModuleName)) #

This function is used to map a package name to a set of import paths. It only returns Just for unit-ids which are possible to import into the current module. In particular, it will return Nothing for `main` components as they can never be imported into another package.