Skip to main content

Monads for Python. Side-effect explicitly.

Project description

Logo

pyEffects

Build Status PyPI version Documentation Status License

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyeffects-1.0.4.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

pyeffects-1.0.4-py2.py3-none-any.whl (12.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyeffects-1.0.4.tar.gz.

File metadata

  • Download URL: pyeffects-1.0.4.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.6.9

File hashes

Hashes for pyeffects-1.0.4.tar.gz
Algorithm Hash digest
SHA256 94084805cd471a56a5d8ef4a006e45bcacea3fe4116ba9f5a60f5ad27d9d4839
MD5 df9f72eb14c6f95826e4fa641ab4b6cb
BLAKE2b-256 81cc0810f65848c28d4e8916fbd6eec2c6f0c75c4e095499682ce776357bfdb5

See more details on using hashes here.

File details

Details for the file pyeffects-1.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: pyeffects-1.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.6.9

File hashes

Hashes for pyeffects-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 52d1165713c7ab579bcd179e9e2b68f67b6bede27dc22d6f05858246e69d5e17
MD5 102dde83f5e47173bf9777b1fbc3e83f
BLAKE2b-256 27f73f1210a133f440f74e44138abbb0fdab0b6d68828396afe6ca802ab08c53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page