Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Simple Eff

A Simple Tiny (only <100 lines) Algebraic Effects Library for Python.

from simple_eff import Effect, eff

not_integer = Effect()

def parse_int(str):
    try:
        return int(str)
    except:
        return None


@eff
def sum_lines(s: str) -> int:
    lines = s.split()
    sum = 0
    for line in lines:
        match parse_int(line):
            case None:
                sum += yield not_integer.perform(line)
            case num:
                sum += num
    return sum


def handle_notinteger(k, v):
    print(f"Parse Error: {v} is not an integer.")
    return k(0)


if __name__ == '__main__':
    twelve = sum_lines("1\n2\nthree\n4\n5")
    twelve.on(not_integer, handle_notinteger)
    ret = twelve.run()
    print(f"Sum: {ret}")

Acknowledgement

This library is ...

  • inspired by effective-rust for the API design.
  • heavily based on ruff for the implementation.

Metadata

Release files for simple-eff 0.0.1a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-eff 0.0.1a2
File Size Uploaded
simple-eff-0.0.1a2.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-eff 0.0.1a2
File Interpreter ABI Platform
simple_eff-0.0.1a2-py3-none-any.whl Python 3 none any Details

Total release size: 4.5 kB

Release files / simple-eff-0.0.1a2.tar.gz

Download URL simple-eff-0.0.1a2.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
48f48d03ee35a34bb59a1e2384657499b6285e86c986c5618bb3b817216e0884
BLAKE2b-256 checksum
How to use checksums
72a16cdf1989dfb437182923a86849ccadb5a0334525073bf9ca592784e754b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Darwin/21.4.0

Release files / simple_eff-0.0.1a2-py3-none-any.whl

Download URL simple_eff-0.0.1a2-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
203fb6c11f4746aed7c57f3d7c9cd112aec6df43fc511e841d347c5e9099dddb
BLAKE2b-256 checksum
How to use checksums
c28db42e96ee313837264514cc1e2453b6b41e9205469c6e441803abd226ffe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Darwin/21.4.0

Release history Release notifications | RSS feed

This release

0.0.1a2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page