{"action":"created","issue":{"url":"https://api.github.com/repos/sanctuary-js/sanctuary/issues/257","repository_url":"https://api.github.com/repos/sanctuary-js/sanctuary","labels_url":"https://api.github.com/repos/sanctuary-js/sanctuary/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/sanctuary-js/sanctuary/issues/257/comments","events_url":"https://api.github.com/repos/sanctuary-js/sanctuary/issues/257/events","html_url":"https://github.com/sanctuary-js/sanctuary/issues/257","id":178821342,"number":257,"title":"Fantasy Land method aliases","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-23T08:58:02Z","updated_at":"2016-09-24T23:50:33Z","closed_at":null,"body":"There are several related questions which must be answered before we can merge #216. Discussing these in a dedicated thread seems wise, as that pull request is very large.\r\n\r\nCurrently we provide Maybe and Either types compatible with the Fantasy Land spec prior to the merging of fantasyland/fantasy-land#146. In #216 we're adding support for the prefixed method names. Should we continue to expose methods via the unprefixed names? Concretely, should we provide `Maybe#map` and `Maybe#fantasy-land/map` or just the latter?\r\n\r\nReasons to alias (:alien:):\r\n\r\n  - to maintain Ramda compatibility until ramda/ramda#1900 is merged; and\r\n  - to support method chaining.\r\n\r\nReasons not to alias (:no_entry_sign: :alien:):\r\n\r\n  - it would violate <i>The Zen of Python</i> (`python -c 'import this' | grep 'only one'`);\r\n  - it would increase Sanctuary's surface area (more to document and test); and\r\n  - method chaining is at odds with Sanctuary's emphasis on function composition.\r\n\r\nIf we decide to include these aliases, there's a second question to answer: should we also provide `Maybe.empty`, `Maybe.of`, and `Either.of`? These are *already* aliases (for `() => Nothing`, `Just`, and `Right` respectively). There's value, of course, in providing the prefixed equivalents to facilitate the creation of polymorphic functions, but if one is dealing with the Maybe type, say, I see no reason to write `Maybe.empty()` rather than `Nothing`. Am I missing anything?\r\n\r\nThe final question is what to do with `Maybe#filter`. It's currently defined for compatibility with [`R.filter`][1] and [`R.reject`][2]. My plan, though, is to define `filter` in sanctuary-type-classes, since it can be derived from other FL functions:\r\n\r\n```javascript\r\n//# filter :: (Monad m, Monoid m a) => ((a -> Boolean), m a) -> m a\r\nvar filter = function(pred, m) {\r\n  return chain(function(x) { return pred(x) ? of(m, x) : empty(m); }, m);\r\n};\r\n```\r\n\r\nThanks, @joneshf, for sharing this approach way back in #10!\r\n\r\nWith `Z.filter` in place, #216 could easily add `S.filter` and `S.reject`. At that point `Maybe#filter` would only be useful for Ramda compatibility. Is that important, do you think?\r\n\r\nI have views on these matters, but I'd love to hear from @safareli and @Bradcomp (and others) before weighing in.\r\n\r\n\r\n[1]: http://ramdajs.com/0.22.1/docs/#filter\r\n[2]: http://ramdajs.com/0.22.1/docs/#reject\r\n"},"comment":{"url":"https://api.github.com/repos/sanctuary-js/sanctuary/issues/comments/249393972","html_url":"https://github.com/sanctuary-js/sanctuary/issues/257#issuecomment-249393972","issue_url":"https://api.github.com/repos/sanctuary-js/sanctuary/issues/257","id":249393972,"user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"created_at":"2016-09-24T23:50:33Z","updated_at":"2016-09-24T23:50:33Z","body":"Thank you both for your thoughtful feedback.\r\n\r\nI intend to do the following:\r\n\r\n  - __Add prefixes to the documentation of the methods.__ We'll document `Maybe#fantasy-land/map`, for example, rather than `Maybe#map`.\r\n\r\n  - __Update the code examples to use `S` functions.__ The doctests for `Maybe#fantasy-land/map`, for example, will feature `S.map` rather than direct method invocations.\r\n\r\n  - __Leave the method aliases.__ These will still be verified by the test suite, but will no longer be documented. We may decide to remove these at some point in the future.\r\n\r\n  - __Remove `Maybe.empty`, `Maybe.of`, and `Either.of`.__ These simply aren't necessary.\r\n\r\n  - __Remove `Maybe#filter`.__ #216 will add `S.filter` and `S.reject` so I don't think maintaining compatibility with the Ramda equivalents is important.\r\n\r\n> It would be nice to have an `S.of` function (does it already exist?) that takes a type as a parameter.\r\n\r\nIt doesn't exist yet, but we can add it in #216 once we agree on the appropriate type of `Z.of` in sanctuary-js/sanctuary-type-classes#3.\r\n"}}
{"actor":{"display_login":"davidchambers"}}