{"id":22258108,"url":"https://github.com/coot/monadicjs","last_synced_at":"2025-08-25T19:03:02.161Z","repository":{"id":148939961,"uuid":"70346617","full_name":"coot/monadicjs","owner":"coot","description":"JavaScript monad library with do-notation","archived":false,"fork":false,"pushed_at":"2016-11-17T18:52:19.000Z","size":36,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-28T07:44:21.641Z","etag":null,"topics":["functional-programming","javascript","javascript-monads","monad","monad-library","state-monad"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-08T17:21:04.000Z","updated_at":"2018-07-11T21:07:02.000Z","dependencies_parsed_at":"2023-10-04T16:27:38.189Z","dependency_job_id":null,"html_url":"https://github.com/coot/monadicjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coot/monadicjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fmonadicjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fmonadicjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fmonadicjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fmonadicjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coot","download_url":"https://codeload.github.com/coot/monadicjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fmonadicjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272116856,"owners_count":24876268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional-programming","javascript","javascript-monads","monad","monad-library","state-monad"],"created_at":"2024-12-03T08:13:30.347Z","updated_at":"2025-08-25T19:03:02.154Z","avatar_url":"https://github.com/coot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/coot/monadicjs.svg)](https://travis-ci.org/coot/monadicjs)\n\n# Monad library for JavaScript\n\nMonads can be very useful for async IO.  They succefully appeared in Haskell.\nHaskell provides the `do` notation for executing monads.  And this library\nports `do` to JavaScript.  Something that looks like this in Haskell\n\n```Haskell\n  do {\n    fileContent \u003c- readFile \"README.md\"\n    putStr fileContent\n  }\n```\n\nwill look like this in JavaScript:\n```JavaScript\n  const fs = require(\"fs\")\n  do_(function*() {\n    const fileContent = yield fs.readFile.bind(null, \"README.md\")\n    console.log(fileContent)\n  })\n```\n\nCheckout tests how to experiment with it.\n\nYou will not be able to code every monad that one can programm in Haskell (like\nthe list monad), but a lot is possible with this approach.  Here is what you\ncan do in Haskell but not with this library:\n```Haskell\n  do {\n    x \u003c- [1,2,3]\n    return (2*x)\n  } {- [2,4,6] -}\n```\n\n# Available monads\n\n* [Maybe](https://github.com/coot/monadicjs/blob/master/lib/maybe.js) [Haskell Maybe](https://wiki.haskell.org/Maybe)\n* [Either](https://github.com/coot/monadicjs/blob/master/lib/either.js)\n* [Promise](https://github.com/coot/monadicjs/blob/master/lib/promise.js)\n* [NodeContinuation](https://github.com/coot/monadicjs/blob/master/lib/node-continuation.js) or node callbacks\n* [State Monad](https://wiki.haskell.org/State_Monad))\n\n# Ideas\n\n* use a (kind of) state monad for [react-redux](https://github.com/reactjs/react-redux) store\n* monad transformers\n* [react-redux](https://github.com/reactjs/react-redux) store middleware\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoot%2Fmonadicjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoot%2Fmonadicjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoot%2Fmonadicjs/lists"}