Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data Module a n = ModuleCore {
- moduleName :: !ModuleName
- moduleIsHeader :: !Bool
- moduleExportTypes :: ![(n, ExportSource n (Type n))]
- moduleExportValues :: ![(n, ExportSource n (Type n))]
- moduleImportTypes :: ![(n, ImportType n (Type n))]
- moduleImportCaps :: ![(n, ImportCap n (Type n))]
- moduleImportValues :: ![(n, ImportValue n (Type n))]
- moduleImportDataDefs :: ![DataDef n]
- moduleImportTypeDefs :: ![(n, (Kind n, Type n))]
- moduleDataDefsLocal :: ![DataDef n]
- moduleTypeDefsLocal :: ![(n, (Kind n, Type n))]
- moduleBody :: !(Exp a n)
- isMainModule :: Module a n -> Bool
- moduleDataDefs :: Ord n => Module a n -> DataDefs n
- moduleTypeDefs :: Ord n => Module a n -> [(n, (Kind n, Type n))]
- moduleKindEnv :: Ord n => Module a n -> KindEnv n
- moduleTypeEnv :: Ord n => Module a n -> TypeEnv n
- moduleEnvT :: Ord n => KindEnv n -> Module a n -> EnvT n
- moduleEnvX :: Ord n => KindEnv n -> TypeEnv n -> DataDefs n -> Module a n -> EnvX n
- modulesEnvT :: Ord n => KindEnv n -> [Module a n] -> EnvT n
- modulesEnvX :: Ord n => KindEnv n -> TypeEnv n -> DataDefs n -> [Module a n] -> EnvX 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
- moduleNameMatchesPath :: FilePath -> ModuleName -> Bool
- data QualName n = QualName ModuleName n
- data ExportSource n t
- = ExportSourceLocal { }
- | ExportSourceLocalNoType { }
- takeTypeOfExportSource :: ExportSource n t -> Maybe t
- mapTypeOfExportSource :: (t -> t) -> ExportSource n t -> ExportSource n t
- data ImportType n t
- = ImportTypeAbstract {
- importTypeAbstractType :: !t
- | ImportTypeBoxed {
- importTypeBoxed :: !t
- = ImportTypeAbstract {
- kindOfImportType :: ImportType n t -> t
- mapKindOfImportType :: (t -> t) -> ImportType n t -> ImportType n t
- data ImportCap n t = ImportCapAbstract {
- importCapAbstractType :: !t
- typeOfImportCap :: ImportCap n t -> t
- mapTypeOfImportCap :: (t -> t) -> ImportCap n t -> ImportCap n t
- data ImportValue n t
- = ImportValueModule {
- importValueModuleName :: !ModuleName
- importValueModuleVar :: !n
- importValueModuleType :: !t
- importValueModuleArity :: !(Maybe (Int, Int, Int))
- | ImportValueSea {
- importValueSeaVar :: !String
- importValueSeaType :: !t
- = ImportValueModule {
- typeOfImportValue :: ImportValue n t -> t
- mapTypeOfImportValue :: (t -> t) -> ImportValue n t -> ImportValue n t
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.
moduleTypeDefs :: Ord n => Module a n -> [(n, (Kind n, Type 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.
:: Ord n | |
=> KindEnv n | Primitive kind environment. |
-> Module a n | Module to extract environemnt from. |
-> EnvT n |
Extract the top-level EnvT
environment from a module.
This includes kinds for abstract types, data types, and type equations, but not primitive types which are fragment specific.
:: Ord n | |
=> KindEnv n | Primitive kind environment. |
-> TypeEnv n | Primitive type environment. |
-> DataDefs n | Primitive data type definitions. |
-> Module a n | Module to extract environemnt from. |
-> EnvX n |
Extract the top-level EnvX
environment from a module.
:: Ord n | |
=> KindEnv n | Primitive kind environment. |
-> [Module a n] | Modules to build environment from. |
-> EnvT n |
Extract the top-level EnvT
environment from several modules.
:: Ord n | |
=> KindEnv n | Primitive kind environment. |
-> TypeEnv n | Primitive type environment. |
-> DataDefs n | Primitive data type definitions. |
-> [Module a n] | Modules to build environment from. |
-> EnvX n |
Extract the top-level EnvT
environment from several modules.
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
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.
moduleNameMatchesPath :: FilePath -> ModuleName -> Bool Source #
Check whether a module name matches the given file path of the module.
If the module is named M1.M2.M3 then the file needs to be called PATHM1M2/M3.EXT for some base PATH and extension EXT.
Qualified names.
A fully qualified name, including the name of the module it is from.
Export Definitions
data ExportSource n t 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. |
takeTypeOfExportSource :: ExportSource n t -> Maybe t Source #
Take the type of an imported thing, if there is one.
mapTypeOfExportSource :: (t -> t) -> ExportSource n t -> ExportSource n t Source #
Apply a function to any type in an ExportSource.
Import Definitions
Import Types
data ImportType n t Source #
Define a 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. |
|
kindOfImportType :: ImportType n t -> t Source #
Take the kind of an ImportType
.
mapKindOfImportType :: (t -> t) -> ImportType n t -> ImportType n t 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 t -> t Source #
Take the type of an ImportCap
.
mapTypeOfImportCap :: (t -> t) -> ImportCap n t -> ImportCap n t Source #
Apply a function to the type in an ImportCapability
.
Import Types
data ImportValue n t 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. |
|
typeOfImportValue :: ImportValue n t -> t Source #
Take the type of an imported thing.
mapTypeOfImportValue :: (t -> t) -> ImportValue n t -> ImportValue n t Source #
Apply a function to the type in an ImportValue.