Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data Module a n = ModuleCore {
- moduleName :: !ModuleName
- moduleIsHeader :: !Bool
- moduleExportTypes :: ![(n, ExportSource n)]
- moduleExportValues :: ![(n, ExportSource n)]
- moduleImportTypes :: ![(n, ImportType n)]
- moduleImportCaps :: ![(n, ImportCap n)]
- moduleImportValues :: ![(n, ImportValue n)]
- moduleImportDataDefs :: ![DataDef n]
- moduleDataDefsLocal :: ![DataDef n]
- moduleBody :: !(Exp a n)
- isMainModule :: Module a n -> Bool
- moduleDataDefs :: Ord n => Module a n -> DataDefs n
- 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)
- mapTopBinds :: (Bind n -> Exp a n -> b) -> Module a n -> [b]
- 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 ModuleName = ModuleName [String]
- readModuleName :: String -> Maybe ModuleName
- isMainModuleName :: ModuleName -> Bool
- data QualName n = QualName ModuleName n
- data ExportSource n
- = ExportSourceLocal { }
- | ExportSourceLocalNoType { }
- takeTypeOfExportSource :: ExportSource n -> Maybe (Type n)
- mapTypeOfExportSource :: (Type n -> Type n) -> ExportSource n -> ExportSource n
- data ImportType n
- = ImportTypeAbstract {
- importTypeAbstractType :: !(Kind n)
- | ImportTypeBoxed {
- importTypeBoxed :: !(Kind n)
- = ImportTypeAbstract {
- kindOfImportType :: ImportType n -> Kind n
- mapKindOfImportType :: (Kind n -> Kind n) -> ImportType n -> ImportType n
- data ImportCap n = ImportCapAbstract {
- importCapAbstractType :: !(Type n)
- typeOfImportCap :: ImportCap n -> Type n
- mapTypeOfImportCap :: (Type n -> Type n) -> ImportCap n -> ImportCap n
- data ImportValue n
- = ImportValueModule {
- importValueModuleName :: !ModuleName
- importValueModuleVar :: !n
- importValueModuleType :: !(Type n)
- importValueModuleArity :: !(Maybe (Int, Int, Int))
- | ImportValueSea {
- importValueSeaVar :: !String
- importValueSeaType :: !(Type n)
- = ImportValueModule {
- typeOfImportValue :: ImportValue n -> Type n
- mapTypeOfImportValue :: (Type n -> Type n) -> ImportValue n -> ImportValue n
Modules
A module can be mutually recursive with other modules.
ModuleCore | |
|
isMainModule :: Module a n -> Bool Source
Check if this is the Main
module.
moduleDataDefs :: Ord n => Module a n -> DataDefs n Source
Get the data type definitions visible in a module.
moduleKindEnv :: Ord n => Module a n -> KindEnv n Source
Get the top-level kind environment of a module, from its imported types.
moduleTypeEnv :: Ord n => Module a n -> TypeEnv n Source
Get the top-level type environment of a module, from its imported values.
moduleTopBinds :: Ord n => Module a n -> Set n Source
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.
mapTopBinds :: (Bind n -> Exp a n -> b) -> Module a n -> [b] Source
Apply a function to all the top-level bindings in a module, producing a list of the results.
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 n Source
Add the kind environment exported by all these modules to the given one.
modulesExportValues :: Ord n => ModuleMap a n -> TypeEnv n -> TypeEnv n Source
Add the type environment exported by all these modules to the given one.
Module Names
data ModuleName Source
A hierarchical module name.
readModuleName :: String -> Maybe ModuleName Source
Read a string like M3
as a module name.
isMainModuleName :: ModuleName -> Bool Source
Check whether this is the name of the "Main" module.
Qualified names.
A fully qualified name, including the name of the module it is from.
Export Definitions
data ExportSource n Source
Define thing exported from a module.
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. |
Show n => Show (ExportSource n) Source | |
NFData n => NFData (ExportSource n) Source |
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 n Source
Apply a function to any type in an ExportSource.
Import Definitions
Import Types
data ImportType n Source
Define a foreign type being imported into a module.
ImportTypeAbstract | Type imported abstractly. Used for phantom types of kind Data, as well as regions, effects, and any other type that does not have kind Data. When a type is imported abstractly it has no associated values, so we can just say that we have the type without worrying about how to represent its associated values. |
| |
ImportTypeBoxed | Type of some boxed data. The objects follow the standard heap object layout, but the code that constructs and destructs them may have been written in a different language. This is used when importing data types defined in Salt modules. |
|
SpreadX ImportType Source | |
Show n => Show (ImportType n) Source | |
NFData n => NFData (ImportType n) Source |
kindOfImportType :: ImportType n -> Kind n Source
Take the kind of an ImportType
.
mapKindOfImportType :: (Kind n -> Kind n) -> ImportType n -> ImportType n Source
Apply a function to the kind of an ImportType
Import Capabilities
Define a foreign capability being imported into a module.
ImportCapAbstract | Capability imported abstractly. For capabilities like (Read r) for some top-level region r we can just say that we have the capability. |
|
typeOfImportCap :: ImportCap n -> Type n Source
Take the type of an ImportCap
.
mapTypeOfImportCap :: (Type n -> Type n) -> ImportCap n -> ImportCap n Source
Apply a function to the type in an ImportCapability
.
Import Types
data ImportValue n Source
Define a foreign value being imported into a module.
ImportValueModule | Value imported from a module that we compiled ourselves. |
| |
ImportValueSea | Value imported via the C calling convention. |
|
SpreadX ImportValue Source | |
Show n => Show (ImportValue n) Source | |
NFData n => NFData (ImportValue n) Source |
typeOfImportValue :: ImportValue n -> Type n Source
Take the type of an imported thing.
mapTypeOfImportValue :: (Type n -> Type n) -> ImportValue n -> ImportValue n Source
Apply a function to the type in an ImportValue.