{"_id":"data.either","_rev":"4179634","name":"data.either","description":"A monad for disjunctions. (e.g.: computations that may fail)","dist-tags":{"latest":"1.5.2"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"time":{"modified":"2026-03-01T21:45:24.000Z","created":"2013-12-25T14:59:02.836Z","1.5.2":"2018-09-04T01:40:06.782Z","1.5.1":"2017-05-26T23:31:06.809Z","1.5.0":"2017-01-13T01:45:57.015Z","1.4.0":"2016-04-08T02:18:22.054Z","1.3.0":"2015-10-18T14:26:05.391Z","1.2.0":"2014-09-21T23:39:39.842Z","1.1.0":"2014-04-11T00:10:58.076Z","1.0.0":"2013-12-25T14:59:02.836Z"},"users":{},"author":{"name":"Quildreen Motta"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.either.git"},"versions":{"1.5.2":{"name":"data.either","version":"1.5.2","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.either.git"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"gitHead":"ac0aefcceb0cef5e32f538118287f65f86fca2da","homepage":"https://github.com/folktale/data.either#readme","_id":"data.either@1.5.2","_npmVersion":"6.4.1","_nodeVersion":"8.11.3","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"5b25cafa7ff1361806e20937a1201c4472763dcf","size":9300,"noattachment":false,"key":"/data.either/-/data.either-1.5.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.5.2.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data.either_1.5.2_1536025206646_0.15135540828579908"},"_hasShrinkwrap":false,"publish_time":1536025206782,"_cnpm_publish_time":1536025206782,"_cnpmcore_publish_time":"2021-12-17T18:17:37.193Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.5.1":{"name":"data.either","version":"1.5.1","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.either.git"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"gitHead":"b4791f092dba1d21bc5caf12ed01a3c0667faea0","homepage":"https://github.com/folktale/data.either#readme","_id":"data.either@1.5.1","_shasum":"71f9dbfc8fe3ab0112e52e443470bcd526f50b47","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"71f9dbfc8fe3ab0112e52e443470bcd526f50b47","size":9364,"noattachment":false,"key":"/data.either/-/data.either-1.5.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.5.1.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data.either-1.5.1.tgz_1495841466711_0.7261143773794174"},"directories":{},"publish_time":1495841466809,"_hasShrinkwrap":false,"_cnpm_publish_time":1495841466809,"_cnpmcore_publish_time":"2021-12-17T18:17:37.422Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.5.0":{"name":"data.either","version":"1.5.0","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.either.git"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"gitHead":"76f759d3c37ddf6433bd8058eb81836d7b1186b3","homepage":"https://github.com/folktale/data.either#readme","_id":"data.either@1.5.0","_shasum":"b838ff92b65206c58baf48d48cc23a07f3859ce2","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.3.0","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"b838ff92b65206c58baf48d48cc23a07f3859ce2","size":9331,"noattachment":false,"key":"/data.either/-/data.either-1.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.5.0.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/data.either-1.5.0.tgz_1484271955204_0.8590224788058549"},"directories":{},"publish_time":1484271957015,"_hasShrinkwrap":false,"_cnpm_publish_time":1484271957015,"_cnpmcore_publish_time":"2021-12-17T18:17:37.614Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.4.0":{"name":"data.either","version":"1.4.0","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.either.git"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"gitHead":"fb1a07993035d31513ea2451468adc4e0a2a6494","homepage":"https://github.com/folktale/data.either#readme","_id":"data.either@1.4.0","_shasum":"fb4dfb180028b0095f19df74a5dd1619d6f1fd19","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"fb4dfb180028b0095f19df74a5dd1619d6f1fd19","size":9219,"noattachment":false,"key":"/data.either/-/data.either-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.4.0.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/data.either-1.4.0.tgz_1460081899369_0.9546493743546307"},"directories":{},"publish_time":1460081902054,"_hasShrinkwrap":false,"_cnpm_publish_time":1460081902054,"_cnpmcore_publish_time":"2021-12-17T18:17:37.814Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.3.0":{"name":"data.either","version":"1.3.0","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.either.git"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"gitHead":"7784eb1cc8c3f4b0722f0094a60210e39cabfe79","homepage":"https://github.com/folktale/data.either#readme","_id":"data.either@1.3.0","_shasum":"4dfc1cc2c5a72157e1072cbc286c394f12f94951","_from":".","_npmVersion":"2.8.3","_nodeVersion":"0.10.25","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"dist":{"shasum":"4dfc1cc2c5a72157e1072cbc286c394f12f94951","size":9038,"noattachment":false,"key":"/data.either/-/data.either-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.3.0.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1445178365391,"_hasShrinkwrap":false,"_cnpm_publish_time":1445178365391,"_cnpmcore_publish_time":"2021-12-17T18:17:38.032Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.2.0":{"name":"data.either","version":"1.2.0","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.either"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"_id":"data.either@1.2.0","dist":{"shasum":"d4325e69e317fe4d8d87f4d4f92dcc442e8af591","size":9018,"noattachment":false,"key":"/data.either/-/data.either-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.2.0.tgz"},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1411342779842,"_hasShrinkwrap":false,"_cnpm_publish_time":1411342779842,"_cnpmcore_publish_time":"2021-12-17T18:17:38.216Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.1.0":{"name":"data.either","version":"1.1.0","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.either"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","ink-docstrap":"git://github.com/robotlolita/docstrap","jsdoc":"^3.3.0-alpha5","claire":"^0.4.1","browserify":"^3.40.0"},"homepage":"https://github.com/folktale/data.either","_id":"data.either@1.1.0","dist":{"shasum":"07076c1a1a107914c1442c9154168a8701affeac","size":8791,"noattachment":false,"key":"/data.either/-/data.either-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.1.0.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1397175058076,"_hasShrinkwrap":false,"_cnpm_publish_time":1397175058076,"_cnpmcore_publish_time":"2021-12-17T18:17:38.441Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"1.0.0":{"name":"data.either","version":"1.0.0","description":"A monad for disjunctions. (e.g.: computations that may fail)","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.either"},"keywords":["fantasy-land","folktale","monads","algebraic","disjunction"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.either/issues"},"dependencies":{"claire":"~0.4.1"},"devDependencies":{"browserify":"git://github.com/robotlolita/node-browserify","groc":"git://github.com/robotlolita/groc#typography","LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"~0.2.0"},"readmeFilename":"README.md","homepage":"https://github.com/folktale/data.either","_id":"data.either@1.0.0","dist":{"shasum":"1bff38688ae89611d622225e154134ad24719309","size":65815,"noattachment":false,"key":"/data.either/-/data.either-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.either/download/data.either-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1387983542836,"_hasShrinkwrap":false,"_cnpm_publish_time":1387983542836,"_cnpmcore_publish_time":"2021-12-17T18:17:38.726Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"}},"readme":"Data.Either\n===========\n\n[![Build Status](https://secure.travis-ci.org/folktale/data.either.png?branch=master)](https://travis-ci.org/folktale/data.either)\n[![NPM version](https://badge.fury.io/js/data.either.png)](http://badge.fury.io/js/data.either)\n[![Dependencies Status](https://david-dm.org/folktale/data.either.png)](https://david-dm.org/folktale/data.either)\n[![stable](http://hughsk.github.io/stability-badges/dist/stable.svg)](http://github.com/hughsk/stability-badges)\n\n\nThe `Either(a, b)` structure represents the logical disjunction between `a` and\n`b`. In other words, `Either` may contain either a value of type `a` or a value\nof type `b`, at any given time. This particular implementation is biased on the\nright value (`b`), thus projections will take the right value over the left\none.\n\nA common use of this structure is to represent computations that may fail, when you\nwant to provide additional information on the failure. This can force failures\nand their handling to be explicit, and avoid the problems associated with\nthrowing exceptions — non locality, abnormal exits, etc.\n\nFurthermore, being a monad, `Either(a, b)` can be composed in manners similar\nto other monads, by using the generic sequencing and composition operations\nprovided for the common interface in [Fantasy Land][].\n\n\n## Example\n\n```js\n// Returns the contents of the file at `path`, if it exists.\n//\n//  read : String -> Either(Error, String)\nfunction read(path) {\n  return exists(path)?     Either.Right(fread(path))\n  :      /* otherwise */   Either.Left(\"Non-existing file: \" + path)\n}\n\nvar intro = read('intro.txt')  // => Right(...)\nvar outro = read('outro.txt')  // => Right(...)\nvar nope  = read('nope.txt')   // => Left(\"Non-existing file: nope.txt\")\n\n// We can concatenate things without knowing if they exist at all, and\n// failures are handled for us\nintro.chain(function(a) {\n  return outro.map(function(b) {\n    return a + b\n  })\n}).orElse(logFailure)\n// => Right(...)\n\nintro.chain(function(a) {\n  return nope.map(function(b) {\n    return a + b\n  })\n})\n// => Left(\"Non-existing file: nope.txt\")\n```\n\n\n## Installing\n\nThe easiest way is to grab it from NPM. If you're running in a Browser\nenvironment, you can use [Browserify][]\n\n    $ npm install data.either\n\n\n### Using with CommonJS\n\nIf you're not using NPM, [Download the latest release][release], and require\nthe `data.either.umd.js` file:\n\n```js\nvar Either = require('data.either')\n```\n\n\n### Using with AMD\n\n[Download the latest release][release], and require the `data.either.umd.js`\nfile:\n\n```js\nrequire(['data.either'], function(Either) {\n  ( ... )\n})\n```\n\n\n### Using without modules\n\n[Download the latest release][release], and load the `data.either.umd.js`\nfile. The properties are exposed in the global `folktale.data.Either` object:\n\n```html\n<script src=\"/path/to/data.either.umd.js\"></script>\n```\n\n\n### Compiling from source\n\nIf you want to compile this library from the source, you'll need [Git][],\n[Make][], [Node.js][], and run the following commands:\n\n    $ git clone git://github.com/folktale/data.either.git\n    $ cd data.either\n    $ npm install\n    $ make bundle\n    \nThis will generate the `dist/data.either.umd.js` file, which you can load in\nany JavaScript environment.\n\n    \n## Documentation\n\nYou can [read the documentation online][docs] or build it yourself:\n\n    $ git clone git://github.com/folktale/data.either.git\n    $ cd data.either\n    $ npm install\n    $ make documentation\n\nThen open the file `docs/index.html` in your browser.\n\n\n## Platform support\n\nThis library assumes an ES5 environment, but can be easily supported in ES3\nplatforms by the use of shims. Just include [es5-shim][] :)\n\n\n## Licence\n\nCopyright (c) 2013 Quildreen Motta.\n\nReleased under the [MIT licence](https://github.com/folktale/data.either/blob/master/LICENCE).\n\n<!-- links -->\n[Fantasy Land]: https://github.com/fantasyland/fantasy-land\n[Browserify]: http://browserify.org/\n[Git]: http://git-scm.com/\n[Make]: http://www.gnu.org/software/make/\n[Node.js]: http://nodejs.org/\n[es5-shim]: https://github.com/kriskowal/es5-shim\n[docs]: http://folktalegithubio.readthedocs.io/en/latest/api/data/either/Either.html\n<!-- [release: https://github.com/folktale/data.either/releases/download/v$VERSION/data.either-$VERSION.tar.gz] -->\n[release]: https://github.com/folktale/data.either/releases/download/v1.5.1/data.either-1.5.1.tar.gz\n<!-- [/release] -->\n","_attachments":{},"homepage":"https://github.com/folktale/data.either#readme","bugs":{"url":"https://github.com/folktale/data.either/issues"},"license":"MIT"}