Safe Haskell | None |
---|---|
Language | Haskell98 |
- data ImportRecord a = ImportRecord {}
- data ImportProvenance
- data Imports = Imports {
- importedTypes :: Map (Qualified (ProperName TypeName)) [ImportRecord (ProperName TypeName)]
- importedDataConstructors :: Map (Qualified (ProperName ConstructorName)) [ImportRecord (ProperName ConstructorName)]
- importedTypeClasses :: Map (Qualified (ProperName ClassName)) [ImportRecord (ProperName ClassName)]
- importedValues :: Map (Qualified Ident) [ImportRecord Ident]
- importedModules :: Set ModuleName
- importedVirtualModules :: Set ModuleName
- nullImports :: Imports
- data Exports = Exports {
- exportedTypes :: [((ProperName TypeName, [ProperName ConstructorName]), ModuleName)]
- exportedTypeClasses :: [(ProperName ClassName, ModuleName)]
- exportedValues :: [(Ident, ModuleName)]
- nullExports :: Exports
- type Env = Map ModuleName (SourceSpan, Imports, Exports)
- primEnv :: Env
- envModuleSourceSpan :: (SourceSpan, a, b) -> SourceSpan
- envModuleImports :: (a, Imports, b) -> Imports
- envModuleExports :: (a, b, Exports) -> Exports
- exportType :: MonadError MultipleErrors m => Exports -> ProperName TypeName -> [ProperName ConstructorName] -> ModuleName -> m Exports
- exportTypeClass :: MonadError MultipleErrors m => Exports -> ProperName ClassName -> ModuleName -> m Exports
- exportValue :: MonadError MultipleErrors m => Exports -> Ident -> ModuleName -> m Exports
- getExports :: MonadError MultipleErrors m => Env -> ModuleName -> m Exports
- checkImportConflicts :: forall m a. (Show a, MonadError MultipleErrors m, MonadWriter MultipleErrors m, Ord a) => ModuleName -> (a -> String) -> [ImportRecord a] -> m (ModuleName, ModuleName)
Documentation
data ImportRecord a Source
The details for an import: the name of the thing that is being imported
(x
if importing from A
), the module that the thing was originally
defined in (for re-export resolution), and the import provenance (see below).
Eq a => Eq (ImportRecord a) Source | |
Ord a => Ord (ImportRecord a) Source | |
Read a => Read (ImportRecord a) Source | |
Show a => Show (ImportRecord a) Source |
data ImportProvenance Source
Used to track how an import was introduced into scope. This allows us to handle the one-open-import special case that allows a name conflict to become a warning rather than being an unresolvable situation.
The imported declarations for a module, including the module's own members.
Imports | |
|
An empty Imports
value.
The exported declarations from a module.
Exports | |
|
An empty Exports
value.
type Env = Map ModuleName (SourceSpan, Imports, Exports) Source
The imports and exports for a collection of modules. The SourceSpan
is used
to store the source location of the module with a given name, used to provide
useful information when there is a duplicate module definition.
envModuleSourceSpan :: (SourceSpan, a, b) -> SourceSpan Source
Extracts the SourceSpan
from an Env
value.
exportType :: MonadError MultipleErrors m => Exports -> ProperName TypeName -> [ProperName ConstructorName] -> ModuleName -> m Exports Source
Safely adds a type and its data constructors to some exports, returning an error if a conflict occurs.
exportTypeClass :: MonadError MultipleErrors m => Exports -> ProperName ClassName -> ModuleName -> m Exports Source
Safely adds a class to some exports, returning an error if a conflict occurs.
exportValue :: MonadError MultipleErrors m => Exports -> Ident -> ModuleName -> m Exports Source
Safely adds a value to some exports, returning an error if a conflict occurs.
getExports :: MonadError MultipleErrors m => Env -> ModuleName -> m Exports Source
checkImportConflicts :: forall m a. (Show a, MonadError MultipleErrors m, MonadWriter MultipleErrors m, Ord a) => ModuleName -> (a -> String) -> [ImportRecord a] -> m (ModuleName, ModuleName) Source
When reading a value from the imports, check that there are no conflicts in scope.