purescript-0.13.2: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Sugar.Names.Env

Synopsis

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).

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.

data Imports Source #

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

Constructors

Imports 

Fields

Instances
Show Imports Source # 
Instance details

Defined in Language.PureScript.Sugar.Names.Env

data Exports Source #

The exported declarations from a module.

Constructors

Exports 

Fields

Instances
Show Exports Source # 
Instance details

Defined in Language.PureScript.Sugar.Names.Env

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 modules.

primExports :: Exports Source #

The exported types from 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.

data ExportMode Source #

When updating the Exports the behaviour is slightly different depending on whether we are exporting values defined within the module or elaborating re-exported values. This type is used to indicate which behaviour should be used.

Constructors

Internal 
ReExport 

exportType :: MonadError MultipleErrors m => SourceSpan -> ExportMode -> Exports -> ProperName TypeName -> [ProperName ConstructorName] -> ExportSource -> m Exports Source #

Safely adds a type and its data constructors to some exports, returning an error if a conflict occurs.

exportTypeOp :: MonadError MultipleErrors m => SourceSpan -> Exports -> OpName TypeOpName -> ExportSource -> m Exports Source #

Safely adds a type operator to some exports, returning an error if a conflict occurs.

exportTypeClass :: MonadError MultipleErrors m => SourceSpan -> ExportMode -> Exports -> ProperName ClassName -> ExportSource -> m Exports Source #

Safely adds a class to some exports, returning an error if a conflict occurs.

exportValue :: MonadError MultipleErrors m => SourceSpan -> Exports -> Ident -> ExportSource -> m Exports Source #

Safely adds a value to some exports, returning an error if a conflict occurs.

exportValueOp :: MonadError MultipleErrors m => SourceSpan -> Exports -> OpName ValueOpName -> ExportSource -> m Exports Source #

Safely adds a value operator to some exports, returning an error if a conflict occurs.

exportKind :: MonadError MultipleErrors m => SourceSpan -> Exports -> ProperName KindName -> ExportSource -> m Exports Source #

Safely adds a kind to some exports, returning an error if a conflict occurs.

getExports :: MonadError MultipleErrors m => Env -> ModuleName -> m Exports Source #

Gets the exports for a module, or raise an error if the module doesn't exist.

checkImportConflicts :: forall m a. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> ModuleName -> (a -> Name) -> [ImportRecord a] -> m (ModuleName, ModuleName) Source #

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