Prelude#
apfel comes with a set of predefined namespace tricks to help you use the library more effectively.
Package Namespace#
Shown as in the documentation.
Some common utilities are re-exported to the package-top apfel namespace.
These can be directly imported from the apfel package.
Tip
The package namespace is properly typed, so it's best to explicitly use these instead of relying on builtins namespace.
Builtins Namespace#
Shown as in the documentation.
Some extremely common utilities are injected to the builtins namespace as module-level side effects.
These can be used directly in the code as soon as the apfel package is imported.
Tip
It is recommended only to use these in REPL or other interactive environments, as patched builtins may cause confusion in toolchains and collaborators.
If you are using Pyright, you can follow the builtins extension documentation to enable autocompletion for these functions.
Catalog#
Functions#
| Module | Function | Package? | Builtins? |
|---|---|---|---|
core.common |
identity |
||
core.common |
imperative |
||
core.common |
not_none |
||
core.common |
todo |
||
core.common |
unimplemented |
||
container.maybe |
just |
||
container.maybe |
nothing |
||
container.maybe |
some |
||
container.result |
ok |
||
container.result |
err |
||
container.result |
caught |
Classes#
| Module | Class | Package? | Builtins? |
|---|---|---|---|
container.maybe |
Maybe |
||
container.result |
Result |
||
container.once |
Once |
||
container.once |
Lazy |