Pinad is a simple python library that adds support for common Monads seen in other languages like Rust, and Haskell.
The source code is currently hosted on GitHub at: https://github.com/RobertLD/pinad
You can install Pinad through from PypI using Pip
# or PyPI pip install pinadThe pinad library currently supports the following common monads:
- Maybe - Used for values where None protection is important
and the following mondas are currently in progress:
- State - Used to maintain state across all transformations performed on a value
- Read - Used to pass implicit configuration information throughout each step in a transformation. Think OO Dependency Injection
- Write - Maintains a stateful accumulator across transformations performed on a value
Please use the issues page to suggest additional features. https://github.com/RobertLD/pinad/issues
frompinadimportMaybedefecho(v): returnvx=None>>>Maybe(x).orElse(1) Maybe(1)None.
The goal of pinad is to add monad support with as few dependencies as possible