Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- 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
Instances
Concrete Module Source # | |
Defined in CPython.Types.Module concreteType :: Module -> Type | |
Object Module Source # | |
Defined in CPython.Types.Module toObject :: Module -> SomeObject Source # fromForeignPtr :: ForeignPtr Module -> Module |
moduleType :: Type Source #
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 Dictionary Source #
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 Text Source #
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 Text Source #
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 Module Source #
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.