The functional programming library you need
Project description
Haskellian
The functional programming library you need
pip install haskellian
Why
- Lazy imports + stub files -> great linting and 0 import time (thanks to
lazy-loader
) - Monadic, method chaining style
- Great typing and overloads
from haskellian import either as E, iter as I, promise as P, Pipe, asyn_iter as AI
Pipe[A]
(simplest monad ever)
Pipe('world hello') \
.f(str.title) \
.f(lambda s: s.split(' ')) \
.f(sorted) \
.f(', '.join) \
.value
# 'Hello, World'
Iter[A]
(generators made ergonomic)
I.Iter(range(100000000000)) \
.map(lambda x: 2*x) \
.filter(lambda x: x % 2 == 0) \
.batch(2) \
.tail()
#.sync() # don't recommend it...
# Iter([(4, 6), (8, 10), (12, 14), (16, 18), (20, 22), ...])
Promise[A]
(awaitables made ergonomic)
async def fetch_users() -> list[str]:
...
async def fetch_user(id) -> str:
...
await P.Promise(fetch_users()) \
.bind(lambda ids: P.all(map(fetch_user, ids))) \
.then(sorted)
AsyncIter[A]
, Either[L, R]
(self-explanatory at this point, right?)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
haskellian-0.3.5.tar.gz
(13.0 kB
view hashes)
Built Distribution
haskellian-0.3.5-py3-none-any.whl
(22.5 kB
view hashes)
Close
Hashes for haskellian-0.3.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59811e3283dbc1b8d3aa6424f76a86239c8322850fd1801a2c344ec38930eb1a |
|
MD5 | 3532748cec48d5bfb185564a7a5f50a7 |
|
BLAKE2b-256 | 8f1502bd4db0ab09f415152f53def9a88cf863d7b56d33ee228e46cdeac5a0a3 |