ddc-core-0.3.2.1: Disciplined Disciple Compiler core language and type checker.

Safe HaskellSafe-Inferred

DDC.Core.Module

Contents

Synopsis

Modules

data Module a n Source

A module can be mutually recursive with other modules.

Constructors

ModuleCore 

Fields

moduleName :: !ModuleName

Name of this module.

moduleExportKinds :: !(Map n (Kind n))

Kinds of exported types.

moduleExportTypes :: !(Map n (Type n))

Types of exported values.

moduleImportKinds :: !(Map n (QualName n, Kind n))

Kinds of imported types, along with the name of the module they are from.

moduleImportTypes :: !(Map n (QualName n, Type n))

Types of imported values, along with the name of the module they are from.

moduleBody :: !(Exp a n)

The module body consists of some let-bindings wrapping a unit data constructor.

We're only interested in the bindings, with the unit being just a place-holder.

Instances

isMainModule :: Module a n -> BoolSource

Check if this is the Main module.

moduleKindEnv :: Ord n => Module a n -> KindEnv nSource

Get the top-level kind environment of a module, from its imported types.

moduleTypeEnv :: Ord n => Module a n -> TypeEnv nSource

Get the top-level type environment of a module, from its imported values.

modulesGetBinds :: Ord n => Map n (Type n) -> Env nSource

Module maps

type ModuleMap a n = Map ModuleName (Module a n)Source

Map of module names to modules.

modulesExportKinds :: Ord n => ModuleMap a n -> KindEnv n -> KindEnv nSource

Add the kind environment exported by all these modules to the given one.

modulesExportTypes :: Ord n => ModuleMap a n -> TypeEnv n -> TypeEnv nSource

Add the type environment exported by all these modules to the given one.

Module Names.

data QualName n Source

A fully qualified name, including the name of the module it is from.

Constructors

QualName ModuleName n 

Instances

Show n => Show (QualName n) 
NFData n => NFData (QualName n) 

isMainModuleName :: ModuleName -> BoolSource

Check whether this is the name of the "Main" module.