https://github.com/mhbxyz/fptk
Pragmatic functional programming helpers for Python.
https://github.com/mhbxyz/fptk
functional functional-programming python
Last synced: 2 months ago
JSON representation
Pragmatic functional programming helpers for Python.
- Host: GitHub
- URL: https://github.com/mhbxyz/fptk
- Owner: mhbxyz
- License: mit
- Created: 2025-08-18T04:14:03.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-01-19T11:00:27.000Z (2 months ago)
- Last Synced: 2026-01-19T16:43:33.273Z (2 months ago)
- Topics: functional, functional-programming, python
- Language: Python
- Homepage: https://mhbxyz.github.io/fptk/
- Size: 281 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Pragmatic functional programming for Python 3.13+
---
## Install
```bash
pip install fptk
```
## Quick Example
```python
from fptk.core.func import pipe
from fptk.adt.option import Some, NOTHING
from fptk.adt.result import Ok, Err
# Compose transformations
result = pipe(5, lambda x: x + 1, lambda x: x * 2) # 12
# Handle absence explicitly
name = Some("alice").map(str.upper).unwrap_or("anonymous") # "ALICE"
# Type-safe error handling
def parse(s: str) -> Result[int, str]:
try:
return Ok(int(s))
except ValueError:
return Err(f"invalid: {s}")
parse("42").map(lambda x: x * 2) # Ok(84)
```
## Documentation
**[mhbxyz.github.io/fptk](https://mhbxyz.github.io/fptk)**
## License
MIT