purescript-0.8.0.0: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell98

Language.PureScript.Sugar.Names.Env

Synopsis

Documentation

data Imports Source

The imported declarations for a module, including the module's own members.

Constructors

Imports 

Fields

importedTypes :: Map (Qualified (ProperName TypeName)) [(Qualified (ProperName TypeName), ModuleName)]

Local names for types within a module mapped to to their qualified names

importedDataConstructors :: Map (Qualified (ProperName ConstructorName)) [(Qualified (ProperName ConstructorName), ModuleName)]

Local names for data constructors within a module mapped to to their qualified names

importedTypeClasses :: Map (Qualified (ProperName ClassName)) [(Qualified (ProperName ClassName), ModuleName)]

Local names for classes within a module mapped to to their qualified names

importedValues :: Map (Qualified Ident) [(Qualified Ident, ModuleName)]

Local names for values within a module mapped to to their qualified names

importedModules :: Set ModuleName

The modules that have been imported into the current scope.

importedVirtualModules :: Set ModuleName

The names of "virtual" modules that come into existence when "import as" is used.

nullImports :: Imports Source

An empty Imports value.

data Exports Source

The exported declarations from a module.

Constructors

Exports 

Fields

exportedTypes :: [((ProperName TypeName, [ProperName ConstructorName]), ModuleName)]

The types exported from each module along with the module they originally came from.

exportedTypeClasses :: [(ProperName ClassName, ModuleName)]

The classes exported from each module along with the module they originally came from.

exportedValues :: [(Ident, ModuleName)]

The values exported from each module along with the module they originally came from.

nullExports :: Exports Source

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.

primEnv :: Env Source

Environment which only contains the Prim module.

envModuleSourceSpan :: (SourceSpan, a, b) -> SourceSpan Source

Extracts the SourceSpan from an Env value.

envModuleImports :: (a, Imports, b) -> Imports Source

Extracts the Imports from an Env value.

envModuleExports :: (a, b, Exports) -> Exports Source

Extracts the Exports 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.

checkImportConflicts :: forall m a. (MonadError MultipleErrors m, Ord a) => (a -> String) -> [(Qualified a, ModuleName)] -> m () Source

When reading a value from the imports, check that there are no conflicts in scope.