Safe Haskell | Safe-Inferred |
---|
- data Module a n = ModuleCore {
- moduleName :: !ModuleName
- moduleExportTypes :: ![(n, ExportSource n)]
- moduleExportValues :: ![(n, ExportSource n)]
- moduleImportTypes :: ![(n, ImportSource n)]
- moduleImportValues :: ![(n, ImportSource n)]
- moduleDataDefsLocal :: ![DataDef n]
- moduleBody :: !(Exp a n)
- isMainModule :: Module a n -> Bool
- moduleKindEnv :: Ord n => Module a n -> KindEnv n
- moduleTypeEnv :: Ord n => Module a n -> TypeEnv n
- moduleTopBinds :: Ord n => Module a n -> Set n
- moduleTopBindTypes :: Ord n => Module a n -> Map n (Type n)
- type ModuleMap a n = Map ModuleName (Module a n)
- modulesExportTypes :: Ord n => ModuleMap a n -> KindEnv n -> KindEnv n
- modulesExportValues :: Ord n => ModuleMap a n -> TypeEnv n -> TypeEnv n
- data QualName n = QualName ModuleName n
- data ModuleName = ModuleName [String]
- isMainModuleName :: ModuleName -> Bool
- data ExportSource n
- = ExportSourceLocal { }
- | ExportSourceLocalNoType { }
- takeTypeOfExportSource :: ExportSource n -> Maybe (Type n)
- mapTypeOfExportSource :: (Type n -> Type n) -> ExportSource n -> ExportSource n
- data ImportSource n
- = ImportSourceAbstract { }
- | ImportSourceModule { }
- | ImportSourceSea { }
- typeOfImportSource :: ImportSource n -> Type n
- mapTypeOfImportSource :: (Type n -> Type n) -> ImportSource n -> ImportSource n
Modules
A module can be mutually recursive with other modules.
ModuleCore | |
|
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.
moduleTopBinds :: Ord n => Module a n -> Set nSource
Get the set of top-level value bindings in a module.
moduleTopBindTypes :: Ord n => Module a n -> Map n (Type n)Source
Get a map of named top-level bindings to their types.
Module maps
type ModuleMap a n = Map ModuleName (Module a n)Source
Map of module names to modules.
modulesExportTypes :: Ord n => ModuleMap a n -> KindEnv n -> KindEnv nSource
Add the kind environment exported by all these modules to the given one.
modulesExportValues :: Ord n => ModuleMap a n -> TypeEnv n -> TypeEnv nSource
Add the type environment exported by all these modules to the given one.
Module Names
A fully qualified name, including the name of the module it is from.
data ModuleName Source
A hierarchical module name.
isMainModuleName :: ModuleName -> BoolSource
Check whether this is the name of the "Main" module.
Export Sources
data ExportSource n Source
ExportSourceLocal | A name defined in this module, with an explicit type. |
| |
ExportSourceLocalNoType | A named defined in this module, without a type attached. We use this version for source language where we infer the type of the exported thing. |
SpreadT ExportSource | |
Eq n => Eq (ExportSource n) | |
Show n => Show (ExportSource n) | |
NFData n => NFData (ExportSource n) |
takeTypeOfExportSource :: ExportSource n -> Maybe (Type n)Source
Take the type of an imported thing, if there is one.
mapTypeOfExportSource :: (Type n -> Type n) -> ExportSource n -> ExportSource nSource
Apply a function to any type in an ExportSource.
Import Sources
data ImportSource n Source
Source of some imported thing.
ImportSourceAbstract | A type imported abstractly. It may be defined in a foreign language, but the Disciple program treats it abstractly. |
ImportSourceModule | Something imported from a Disciple module that we compiled ourself. |
ImportSourceSea | Something imported via the C calling convention. |
SpreadX ImportSource | |
Eq n => Eq (ImportSource n) | |
Show n => Show (ImportSource n) | |
NFData n => NFData (ImportSource n) |
typeOfImportSource :: ImportSource n -> Type nSource
Take the type of an imported thing.
mapTypeOfImportSource :: (Type n -> Type n) -> ImportSource n -> ImportSource nSource
Apply a function to the type in an ImportSource.