Safe Haskell | None |
---|
- data Module
- moduleType :: Type
- new :: Text -> IO Module
- getDictionary :: Module -> IO Dictionary
- getName :: Module -> IO Text
- getFilename :: Module -> IO Text
- addObject :: Object value => Module -> Text -> value -> IO ()
- addIntegerConstant :: Module -> Text -> Integer -> IO ()
- addTextConstant :: Module -> Text -> Text -> IO ()
- importModule :: Text -> IO Module
- reload :: Module -> IO Module
Documentation
new :: Text -> IO ModuleSource
Return a new module object with the __name__
attribute set. Only the
module’s __doc__
and __name__
attributes are filled in; the
caller is responsible for providing a __file__
attribute.
getDictionary :: Module -> IO DictionarySource
Return the dictionary object that implements a module’s namespace;
this object is the same as the __dict__
attribute of the module. This
computation never fails. It is recommended extensions use other
computations rather than directly manipulate a module’s __dict__
.
getName :: Module -> IO TextSource
Returns a module’s __name__
value. If the module does not
provide one, or if it is not a string, throws SystemError
.
getFilename :: Module -> IO TextSource
Returns the name of the file from which a module was loaded using the
module’s __file__
attribute. If this is not defined, or if it is
not a string, throws SystemError
.
addObject :: Object value => Module -> Text -> value -> IO ()Source
Add an object to a module with the given name. This is a convenience computation which can be used from the module’s initialization computation.
addIntegerConstant :: Module -> Text -> Integer -> IO ()Source
Add an integer constant to a module. This convenience computation can be used from the module’s initialization computation.
addTextConstant :: Module -> Text -> Text -> IO ()Source
Add a string constant to a module. This convenience computation can be used from the module’s initialization computation.
importModule :: Text -> IO ModuleSource
This is a higher-level interface that calls the current “import
hook” (with an explicit level of 0
, meaning absolute import). It
invokes the __import__()
computation from the __builtins__
of the
current globals. This means that the import is done using whatever import
hooks are installed in the current environment.
This computation always uses absolute imports.