{ "info": { "author": "Matthew Franglen", "author_email": "matthew@franglen.org", "bugtrack_url": null, "classifiers": [], "description": "Matts Majestic Monads\n---------------------\n\n[![pipeline status](https://gitlab.com/matthewfranglen/matts-majestic-monads/badges/master/pipeline.svg)](https://gitlab.com/matthewfranglen/matts-majestic-monads/commits/master)\n[![coverage report](https://gitlab.com/matthewfranglen/matts-majestic-monads/badges/master/coverage.svg)](https://gitlab.com/matthewfranglen/matts-majestic-monads/commits/master)\n\nThis overblown library implements Functor, Applicative and Monad in Python.\n\nSynopsis\n--------\n\nYou can use `Either.convert` or `Maybe.convert` as a decorator to convert return types.\nThis example converts exceptions into Left values:\n\n```python\nfrom monads import Either\n\n@Either.convert\ndef parse_arguments():\n parser = argparse.ArgumentParser(description='Download a URL and print it')\n parser.add_argument('URL', help='URL to download')\n return parser.parse_args()\n```\n\nOnce you have your Either you can use `fmap` and `bind` to operate over the contained value:\n\n```python\nresult = (\n make_parser()\n .fmap(parse)\n .fmap(to_url)\n .bind(read)\n)\n```\n\nThe methods will be passed the current value.\nYou should use `fmap` when the function will return a normal value.\nWhen the function returns a monad, use `bind`.\n\nYou can use `Function` as a decorator to convert functions.\nOnce converted they become composable:\n\n```python\nfrom monads import Function\n\n@Function\ndef parse(parser):\n return parser.parse_args()\n\n@Function\ndef to_url(arguments):\n return arguments.URL\n\nboth = parse.compose(to_url)\n```\n\nExample\n-------\n\nThere is a simple example of using this library in `example.py`.\nThis script reads a url that you provide and prints the length of the body:\n\n```bash\n\u279c pipenv run python example.py 'http://python.org/'\nRight(48817)\n```\n\n```bash\n\u279c pipenv run python example.py 'http://pythonasdasd.org/'\nLeft()\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/matthewfranglen/matts-majestic-monads", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "matts-majestic-monads", "package_url": "https://pypi.org/project/matts-majestic-monads/", "platform": "", "project_url": "https://pypi.org/project/matts-majestic-monads/", "project_urls": { "Homepage": "https://gitlab.com/matthewfranglen/matts-majestic-monads" }, "release_url": "https://pypi.org/project/matts-majestic-monads/0.0.5/", "requires_dist": null, "requires_python": "", "summary": "Monadic data structures", "version": "0.0.5" }, "last_serial": 5115582, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3e0463ea3ab42815b47ca3d8a56735ff", "sha256": "d6451c977f3700e7ccb7bc80eb28652199a3c11926ee7efb2a57ae817c6ef7b3" }, "downloads": -1, "filename": "matts-majestic-monads-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3e0463ea3ab42815b47ca3d8a56735ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3123, "upload_time": "2019-04-05T20:22:28", "url": "https://files.pythonhosted.org/packages/6a/da/c0c4e6980d50cc51d8cd7b2ee977473325a5398ce9840da36ffac2a998ec/matts-majestic-monads-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c7e51e1e1d79df2a164f4d7cff80be77", "sha256": "b05c15624dcf885bdb63b5c43fc27a455a470ce91bf8657ff0b2b4b4a080a0cc" }, "downloads": -1, "filename": "matts-majestic-monads-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c7e51e1e1d79df2a164f4d7cff80be77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4122, "upload_time": "2019-04-05T22:13:31", "url": "https://files.pythonhosted.org/packages/30/83/7dc6ee080817a1b871e11ad5862d3769892e7b1d2e3e349e1da1ee5e8bc5/matts-majestic-monads-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "8d2317683bf60068fc95f74f4b41e5f6", "sha256": "d56b2ae2a7ea5fd5e3509a608babf1ed78338de0fcd9c8d7a027de0fbf22dbe0" }, "downloads": -1, "filename": "matts-majestic-monads-0.0.3.tar.gz", "has_sig": false, "md5_digest": "8d2317683bf60068fc95f74f4b41e5f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4531, "upload_time": "2019-04-05T23:51:42", "url": "https://files.pythonhosted.org/packages/5a/49/a2b015c6937fdfd7bd8fbfbc7ca6ad6b471a3cce7b2f9895f3eaa239036e/matts-majestic-monads-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1adf71dcc59352ed2e6e25dc65315f23", "sha256": "7dd4445b805f140d9f7c8a7e01f356edb5fa470c6e1ffd4a55ae9a00b5293a62" }, "downloads": -1, "filename": "matts-majestic-monads-0.0.4.tar.gz", "has_sig": false, "md5_digest": "1adf71dcc59352ed2e6e25dc65315f23", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5065, "upload_time": "2019-04-06T00:11:51", "url": "https://files.pythonhosted.org/packages/7a/17/3c65e3fce28a10e46979994d603f6fc40351a8c0149c0c3f41b0a70a8015/matts-majestic-monads-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "94fee0db26f3c7cecd5e8a58e061a994", "sha256": "53b70bbc93cff7aaef6a6091fa444f6418d9b3716f91ee1908e84b83bffee3ca" }, "downloads": -1, "filename": "matts-majestic-monads-0.0.5.tar.gz", "has_sig": false, "md5_digest": "94fee0db26f3c7cecd5e8a58e061a994", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6522, "upload_time": "2019-04-08T20:54:52", "url": "https://files.pythonhosted.org/packages/bd/a2/41ac8812596fe2357d3c683792fb9f6f415129d98378ae7573f55ed33c29/matts-majestic-monads-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "94fee0db26f3c7cecd5e8a58e061a994", "sha256": "53b70bbc93cff7aaef6a6091fa444f6418d9b3716f91ee1908e84b83bffee3ca" }, "downloads": -1, "filename": "matts-majestic-monads-0.0.5.tar.gz", "has_sig": false, "md5_digest": "94fee0db26f3c7cecd5e8a58e061a994", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6522, "upload_time": "2019-04-08T20:54:52", "url": "https://files.pythonhosted.org/packages/bd/a2/41ac8812596fe2357d3c683792fb9f6f415129d98378ae7573f55ed33c29/matts-majestic-monads-0.0.5.tar.gz" } ] }