{"_id":"data.task","_rev":"4179647","name":"data.task","description":"A structure for representing asynchronous actions with automatic resource handling.","dist-tags":{"latest":"3.1.2"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"time":{"modified":"2026-03-01T21:45:27.000Z","created":"2015-03-22T19:10:04.135Z","3.1.2":"2018-09-04T01:21:29.956Z","3.1.1":"2016-09-01T00:12:27.889Z","3.1.0":"2016-04-08T16:43:27.605Z","3.0.0":"2015-03-22T19:10:04.135Z"},"users":{},"author":{"name":"Quildreen Motta"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.task.git"},"versions":{"3.1.2":{"name":"data.task","version":"3.1.2","description":"A structure for representing asynchronous actions with automatic resource handling.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.task.git"},"keywords":["fantasy-land","folktale","monads","algebraic","promises","futures","asynchronous"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.task/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","bluebird":"~2.9.14","boo":"^2.0.0","browserify":"^3.41.0","claire":"~0.4.1","control.monads":"~0.6.0","hifive":"~0.1.0","hifive-tap":"~0.1.0","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","laws":"^0.2.1","pinky":"^0.1.3","pinky-combinators":"^0.1.1","prelude-ls":"^1.1.1","tape":"^4.5.1","test.benchmark":"~0.3.0","uglify-js":"~2.6.0"},"gitHead":"177522f7dcee2d5b086775a3962ce1d04d5caef7","homepage":"https://github.com/folktale/data.task#readme","_id":"data.task@3.1.2","_npmVersion":"6.4.1","_nodeVersion":"8.11.3","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"f61511339ad5c5ac6f417cc2666b95153dc7448d","size":6489,"noattachment":false,"key":"/data.task/-/data.task-3.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.task/download/data.task-3.1.2.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/data.task_3.1.2_1536024089850_0.9873968529284063"},"_hasShrinkwrap":false,"publish_time":1536024089956,"_cnpm_publish_time":1536024089956,"_cnpmcore_publish_time":"2021-12-18T18:30:18.524Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"3.1.1":{"name":"data.task","version":"3.1.1","description":"A structure for representing asynchronous actions with automatic resource handling.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.task.git"},"keywords":["fantasy-land","folktale","monads","algebraic","promises","futures","asynchronous"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.task/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","bluebird":"~2.9.14","boo":"^2.0.0","browserify":"^3.41.0","claire":"~0.4.1","control.monads":"~0.6.0","hifive":"~0.1.0","hifive-tap":"~0.1.0","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","laws":"^0.2.1","pinky":"^0.1.3","pinky-combinators":"^0.1.1","prelude-ls":"^1.1.1","tape":"^4.5.1","test.benchmark":"~0.3.0","uglify-js":"~2.4.3"},"gitHead":"fcf4233181fa01b2106a561c187f4cd616e058a1","homepage":"https://github.com/folktale/data.task#readme","_id":"data.task@3.1.1","_shasum":"e985f5bedadd926b2d63c1a5d2076cff917a52ad","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.5.0","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"e985f5bedadd926b2d63c1a5d2076cff917a52ad","size":6558,"noattachment":false,"key":"/data.task/-/data.task-3.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.task/download/data.task-3.1.1.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/data.task-3.1.1.tgz_1472688744957_0.6640961980447173"},"directories":{},"publish_time":1472688747889,"_hasShrinkwrap":false,"_cnpm_publish_time":1472688747889,"_cnpmcore_publish_time":"2021-12-18T18:30:18.774Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"3.1.0":{"name":"data.task","version":"3.1.0","description":"A structure for representing asynchronous actions with automatic resource handling.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.task.git"},"keywords":["fantasy-land","folktale","monads","algebraic","promises","futures","asynchronous"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.task/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","bluebird":"~2.9.14","boo":"^2.0.0","browserify":"^3.41.0","claire":"~0.4.1","control.monads":"~0.6.0","hifive":"~0.1.0","hifive-tap":"~0.1.0","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","laws":"^0.2.1","pinky":"^0.1.3","pinky-combinators":"^0.1.1","prelude-ls":"^1.1.1","tape":"^4.5.1","test.benchmark":"~0.3.0","uglify-js":"~2.4.3"},"gitHead":"03ba3661a8388fa45f93a6c6f5f5e55febb25106","homepage":"https://github.com/folktale/data.task#readme","_id":"data.task@3.1.0","_shasum":"85902dcf6f5c380bf58d3f9271d9efd5f16ecf8a","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"85902dcf6f5c380bf58d3f9271d9efd5f16ecf8a","size":11494,"noattachment":false,"key":"/data.task/-/data.task-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.task/download/data.task-3.1.0.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/data.task-3.1.0.tgz_1460133804856_0.04176672315225005"},"directories":{},"publish_time":1460133807605,"_hasShrinkwrap":false,"_cnpm_publish_time":1460133807605,"_cnpmcore_publish_time":"2021-12-18T18:30:19.005Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"},"3.0.0":{"name":"data.task","version":"3.0.0","description":"A structure for representing asynchronous actions with automatic resource handling.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"https://github.com/folktale/data.task"},"keywords":["fantasy-land","folktale","monads","algebraic","promises","futures","asynchronous"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.task/issues"},"dependencies":{},"devDependencies":{"boo":"^2.0.0","pinky":"^0.1.3","pinky-combinators":"^0.1.1","prelude-ls":"^1.1.1","claire":"~0.4.1","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","browserify":"^3.41.0","jsdoc":"^3.3.0-alpha5","test.benchmark":"~0.3.0","control.monads":"~0.6.0","bluebird":"~2.9.14"},"_id":"data.task@3.0.0","dist":{"shasum":"ef111a5ab950314b0c07dafef8b7c5601886c925","size":494418,"noattachment":false,"key":"/data.task/-/data.task-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.task/download/data.task-3.0.0.tgz"},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"publish_time":1427051404135,"_hasShrinkwrap":false,"_cnpm_publish_time":1427051404135,"_cnpmcore_publish_time":"2021-12-18T18:30:19.373Z","deprecated":"This package is no longer supported. Consider switching to fp-ts"}},"readme":"Data.Task\n=========\n\n[![Build status](https://img.shields.io/travis/folktale/data.task/master.svg?style=flat-square)](https://travis-ci.org/folktale/data.task)[![NPM version](https://img.shields.io/npm/v/data.task.svg?style=flat-square)](https://npmjs.org/package/data.task)[![Dependencies status](https://img.shields.io/david/folktale/data.task.svg?style=flat-square)](https://david-dm.org/folktale/data.task)![Licence](https://img.shields.io/npm/l/data.task.svg?style=flat-square&label=licence)![Stable API](https://img.shields.io/badge/API_stability-stable-green.svg?style=flat-square)\n\nThe `Task(a, b)` structure represents values that depend on time. This allows one\nto model time-based effects explicitly, such that one can have full knowledge\nof when they're dealing with delayed computations, latency, or anything that\ncan not be computed immediately.\n\nA common use for this monad is to replace the usual\n[Continuation-Passing Style][CPS] form of programming, in order to be able to\ncompose and sequence time-dependent effects using the generic and powerful\nmonadic operations.\n\n## Example\n\n```js\nvar Task = require('data.task')\nvar fs = require('fs')\n\n// read : String -> Task(Error, Buffer)\nfunction read(path) {\n  return new Task(function(reject, resolve) {\n    fs.readFile(path, function(error, data) {\n      if (error)  reject(error)\n      else        resolve(data)\n    })\n  })\n}\n\n// decode : Task(Error, Buffer) -> Task(Error, String)\nfunction decode(task) {\n  return task.map(function(buffer) {\n    return buffer.toString('utf-8')\n  })\n}\n\nvar intro = decode(read('intro.txt'))\nvar outro = decode(read('outro.txt'))\n\n// You can use `.chain` to sequence two asynchronous actions, and\n// `.map` to perform a synchronous computation with the eventual\n// value of the Task.\nvar concatenated = intro.chain(function(a) {\n                     return outro.map(function(b) {\n                       return a + b\n                     })\n                   })\n\n// But the implementation of Task is pure, which means that you'll\n// never observe the effects by using `chain` or `map` or any other\n// method. The Task just records the sequence of actions that you\n// wish to observe, and defers the playing of that sequence of actions\n// for your application's entry-point to call.\n//\n// To observe the effects, you have to call the `fork` method, which\n// takes a callback for the rejection, and a callback for the success.\nconcatenated.fork(\n  function(error) { throw error }\n, function(data)  { console.log(data) }\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.task\n\n### Using with CommonJS\n\nIf you're not using NPM, [Download the latest release][release], and require\nthe `data.task.umd.js` file:\n\n```js\nvar Task = require('data.task')\n```\n\n### Using with AMD\n\n[Download the latest release][release], and require the `data.task.umd.js`\nfile:\n\n```js\nrequire(['data.task'], function(Task) {\n  ( ... )\n})\n```\n\n### Using without modules\n\n[Download the latest release][release], and load the `data.task.umd.js`\nfile. The properties are exposed in the global `Task` object:\n\n```html\n<script src=\"/path/to/data.task.umd.js\"></script>\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.task.git\n    $ cd data.task\n    $ npm install\n    $ make bundle\n\nThis will generate the `dist/data.task.umd.js` file, which you can load in\nany JavaScript environment.\n\n## Documentation\n\nYou can [read the documentation online][docs] or build it yourself:\n\n    $ git clone git://github.com/folktale/data.task.git\n    $ cd data.task\n    $ npm install\n    $ make documentation\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## Licence\n\nCopyright (c) 2013-2015 Quildreen Motta.\n\nReleased under the [MIT licence](https://github.com/folktale/data.task/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/task/index.html\n[CPS]: http://matt.might.net/articles/by-example-continuation-passing-style/\n<!-- [release: https://github.com/folktale/data.task/releases/download/v$VERSION/data.task-$VERSION.tar.gz] -->\n[release]: https://github.com/folktale/data.task/releases/download/v3.0.0/data.task-3.0.0.tar.gz\n<!-- [/release] -->\n","_attachments":{},"homepage":"https://github.com/folktale/data.task#readme","bugs":{"url":"https://github.com/folktale/data.task/issues"},"license":"MIT"}