A set of tools for conveniently using monads
Project description
# Simplads #
Simplads are a way to structure complicated algorithms. Design and test each function independently and provide a single linking function to explain exactly what the code does. Elegantly introduce stateful operations only when needed without sacrificing readability or testability.
### Example usage ###
```python
from simplads import Bundle, WriterDeltaMaker, ReaderDeltamaker, lift
write = WriterDeltaMaker.write
read = ReaderDeltaMaker.read
# read and write example
def example():
obj = {}
b = Bundle().add_writer(obj).add_reader(obj)
return b.unit().pipe([
write,
read,
lift(lambda i: i.read_val)])
def read(i):
return Bundle.delta(i, 'writer', write(keys=['keys'], new_data='val'))
def write(i):
return Bundle.delta(i, 'reader', read(['key']))
```
### Installation ###
pip install simplads
Simplads are a way to structure complicated algorithms. Design and test each function independently and provide a single linking function to explain exactly what the code does. Elegantly introduce stateful operations only when needed without sacrificing readability or testability.
### Example usage ###
```python
from simplads import Bundle, WriterDeltaMaker, ReaderDeltamaker, lift
write = WriterDeltaMaker.write
read = ReaderDeltaMaker.read
# read and write example
def example():
obj = {}
b = Bundle().add_writer(obj).add_reader(obj)
return b.unit().pipe([
write,
read,
lift(lambda i: i.read_val)])
def read(i):
return Bundle.delta(i, 'writer', write(keys=['keys'], new_data='val'))
def write(i):
return Bundle.delta(i, 'reader', read(['key']))
```
### Installation ###
pip install simplads
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
simplads-0.38.tar.gz
(7.5 kB
view details)
File details
Details for the file simplads-0.38.tar.gz
.
File metadata
- Download URL: simplads-0.38.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f3bec3a2f1e1fd61f8d1f78d5441d7098e309d6e9a1c84d6e8b4094cfdc380 |
|
MD5 | d9983d075553eb06ea75e2c89b449cb6 |
|
BLAKE2b-256 | 4bb2ae44c6e455ff0044b4efabd537b4e5e79ba73ea9bebc2af57d2e1d5634f1 |