pyEffects
Monads for Python. Side-effect explicitly.
Handle your side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future.
For more detailed information, please refer to the API Documentation.
1. Install
pip install pyeffects
2. Using Option
>>> from pyeffects.Option import *
>>> val = Some(5).map(lambda v: v * v)
>>> val
Some(25)
>>> val.is_defined()
True
>>> val.get()
25
3. Using Try
>>> from pyeffects.Try import *
>>> val = Success(5).map(lambda v: v * v)
>>> val
Success(25)
>>> val.is_success()
True
>>> val.get()
25
4. Using Either
>>> from pyeffects.Either import *
>>> val = Right(5).map(lambda v: v * v)
>>> val
Right(25)
>>> val.is_right()
True
>>> val.right()
25
5. Using Future
>>> from pyeffects.Future import *
>>> val = Future.of(5).map(lambda v: v * v)
>>> val
Future(Success(25))
>>> val.on_complete(lambda v: print(v))
Success(25)
>>> val.get()
25
6. Reporting an Issue
Please report any issues or bugs to the Github issues page.
7. License
This project is licensed under the Apache 2 License.
Release files for pyeffects 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyeffects-1.0.5.tar.gz | 10.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyeffects-1.0.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 22.9 kB
Release files / pyeffects-1.0.5.tar.gz
| Download URL | pyeffects-1.0.5.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe59f26f3bdb638acf0d5cbe53d5cc39a588fb24cc153105cc7ea200076d425c
|
|
BLAKE2b-256 checksum How to use checksums |
8c636c8b1409a4263d2886067ce50a237d1105cd88ea09741e2dfe49193bd1cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Release files / pyeffects-1.0.5-py2.py3-none-any.whl
| Download URL | pyeffects-1.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
db761472ae52494635af6e944918df669096193b7a84b3f436c20d47b4205ba4
|
|
BLAKE2b-256 checksum How to use checksums |
16060d633139fac84900152e961a7cfb3fa8649c24aaa1ad4c0ffe0dae8d97e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|