| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
CPython.Types.Function
- data Function
- functionType :: Type
- new :: Code -> Dictionary -> IO Function
- getCode :: Function -> IO Code
- getGlobals :: Function -> IO Dictionary
- getModule :: Function -> IO SomeObject
- getDefaults :: Function -> IO (Maybe Tuple)
- setDefaults :: Function -> Maybe Tuple -> IO ()
- getClosure :: Function -> IO (Maybe Tuple)
- setClosure :: Function -> Maybe Tuple -> IO ()
- getAnnotations :: Function -> IO (Maybe Dictionary)
- setAnnotations :: Function -> Maybe Dictionary -> IO ()
Documentation
functionType :: Type Source #
new :: Code -> Dictionary -> IO Function Source #
Return a new function associated with the given code object. The second parameter will be used as the globals accessible to the function.
The function's docstring, name, and module are retrieved from the
code object. The parameter defaults and closure are set to Nothing.
getGlobals :: Function -> IO Dictionary Source #
Return the globals dictionary associated with a function.
getModule :: Function -> IO SomeObject Source #
Return the module attribute of a function. This is normally
a Unicode containing the module name, but can be set to any other
object by Python code.
getDefaults :: Function -> IO (Maybe Tuple) Source #
Return the default parameter values for a function. This can be a tuple
or Nothing.
getClosure :: Function -> IO (Maybe Tuple) Source #
Return the closure associated with a function. This can be Nothing,
or a tuple of Cells.
setClosure :: Function -> Maybe Tuple -> IO () Source #
Set the closure associated with a function. The tuple should contain
Cells.
getAnnotations :: Function -> IO (Maybe Dictionary) Source #
Return the annotations for a function. This can be a mutable dictionary,
or Nothing.
setAnnotations :: Function -> Maybe Dictionary -> IO () Source #
Set the annotations for a function object.