{"action":"created","issue":{"url":"https://api.github.com/repos/paldepind/flyd/issues/104","repository_url":"https://api.github.com/repos/paldepind/flyd","labels_url":"https://api.github.com/repos/paldepind/flyd/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/paldepind/flyd/issues/104/comments","events_url":"https://api.github.com/repos/paldepind/flyd/issues/104/events","html_url":"https://github.com/paldepind/flyd/pull/104","id":142545953,"number":104,"title":"Implementing error handling as described in issue #35","user":{"login":"jplikesbikes","id":878980,"avatar_url":"https://avatars.githubusercontent.com/u/878980?v=3","gravatar_id":"","url":"https://api.github.com/users/jplikesbikes","html_url":"https://github.com/jplikesbikes","followers_url":"https://api.github.com/users/jplikesbikes/followers","following_url":"https://api.github.com/users/jplikesbikes/following{/other_user}","gists_url":"https://api.github.com/users/jplikesbikes/gists{/gist_id}","starred_url":"https://api.github.com/users/jplikesbikes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jplikesbikes/subscriptions","organizations_url":"https://api.github.com/users/jplikesbikes/orgs","repos_url":"https://api.github.com/users/jplikesbikes/repos","events_url":"https://api.github.com/users/jplikesbikes/events{/privacy}","received_events_url":"https://api.github.com/users/jplikesbikes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-22T04:32:38Z","updated_at":"2016-03-22T04:33:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/paldepind/flyd/pulls/104","html_url":"https://github.com/paldepind/flyd/pull/104","diff_url":"https://github.com/paldepind/flyd/pull/104.diff","patch_url":"https://github.com/paldepind/flyd/pull/104.patch"},"body":"## Ethos\r\n+ It should not be the concern of `flyd` to handle exceptions for the user -- any `throw` should result in a hard failure.\r\n+ Silent failures are bad (current way `flyd` handles Promise.reject)\r\n+ Be as unopinionated in implementation as possible\r\n+ Be functional in design\r\n+ Be as backward compatible as possible with the current api\r\n\r\n## Concepts\r\n+ The stream is of `events`\r\n+ Each stream has a `left` and a `right` side (like an Either)\r\n+ The right side is the domain objects\r\n+ The left side is meta (in most cases errors)\r\n+ By default the api operates on the `right` side\r\n\r\n## The Api\r\n`s` is a stream\r\n\r\n### Setting data s(...) is overloaded\r\n+ `s(value)` is the default case takes a value makes it a right and pushes it down the stream\r\n+ `s(promise)` if the promise resolves pushes a right, otherwise pushes a left\r\n+ `s(either)` pushes down right or left based on either.left either.right\r\n+ `s.left(value)` sets the stream to a left of `value`\r\n\r\n### Getting data\r\n+ `s()` get the last right value or throws an exception if there is a left value\r\n+ `s.left()` get the last left value or throws an exception if there is a right value\r\n\r\n### Checking stream state\r\n+ `s.isLeft()` return boolean so you know what the stream contains\r\n\r\n### Core functions\r\n+ `.map()` works only on rights and ignores lefts\r\n+ `.mapAll()` gets all events as an `Either`\r\n+ `.combine()` and `.merge()` stay the same they work on streams\r\n+ `ap()` works on `rights` only\r\n+ `.scan()` works on `rights` only\r\n+ `.on()` works on `rights` only\r\n\r\n### The Either implementation\r\nThere are no additional dependencies and we have provided a minimal  implementation for basic use. If you plan on using `.mapAll` we recommend overriding the methods in flyd.Either. You can use [folktale/data.either](https://github.com/folktale/data.either) for example as shown below.\r\n```\r\nvar DE = require('data.either');\r\nflyd.Either.Right = DE.Right;\r\nflyd.Either.Left = DE.Left;\r\nflyd.Either.isEither = function(obj) { return obj instanceof DE; };\r\nflyd.Either.isRight = function(e) { return e.isRight; };\r\nflyd.Either.getRight = function(e) { return e.value; };\r\nflyd.Either.getLeft = function(e) { return e.value; };\r\n```\r\n\r\n### Other functionality\r\nKeeping with the ethos of flyd any further functions like `.swap` or `.onAll` should be implemented as modules."},"comment":{"url":"https://api.github.com/repos/paldepind/flyd/issues/comments/199634313","html_url":"https://github.com/paldepind/flyd/pull/104#issuecomment-199634313","issue_url":"https://api.github.com/repos/paldepind/flyd/issues/104","id":199634313,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T04:33:49Z","updated_at":"2016-03-22T04:33:49Z","body":"\n[![Coverage Status](https://coveralls.io/builds/5499533/badge)](https://coveralls.io/builds/5499533)\n\nCoverage remained the same at 100.0% when pulling **61872ce1c6efec0435a6950fcd29816a11704ff5 on jplikesbikes:master** into **5753f0eb2b60d035e4f1602620fb78ee61db5c57 on paldepind:master**.\n"}}