{"action":"created","issue":{"url":"https://api.github.com/repos/fantasyland/fantasy-land/issues/144","repository_url":"https://api.github.com/repos/fantasyland/fantasy-land","labels_url":"https://api.github.com/repos/fantasyland/fantasy-land/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/fantasyland/fantasy-land/issues/144/comments","events_url":"https://api.github.com/repos/fantasyland/fantasy-land/issues/144/events","html_url":"https://github.com/fantasyland/fantasy-land/issues/144","id":167443440,"number":144,"title":"Changing ap arguments order for consistency with map and chain, and for better types support","user":{"login":"rpominov","id":825702,"avatar_url":"https://avatars.githubusercontent.com/u/825702?v=3","gravatar_id":"","url":"https://api.github.com/users/rpominov","html_url":"https://github.com/rpominov","followers_url":"https://api.github.com/users/rpominov/followers","following_url":"https://api.github.com/users/rpominov/following{/other_user}","gists_url":"https://api.github.com/users/rpominov/gists{/gist_id}","starred_url":"https://api.github.com/users/rpominov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpominov/subscriptions","organizations_url":"https://api.github.com/users/rpominov/orgs","repos_url":"https://api.github.com/users/rpominov/repos","events_url":"https://api.github.com/users/rpominov/events{/privacy}","received_events_url":"https://api.github.com/users/rpominov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-25T19:15:59Z","updated_at":"2016-07-25T21:20:35Z","closed_at":null,"body":"The current order of arguments (if we count `this` as an argument) in `ap` is problematic. I see two problems about it.\r\n\r\n### It's inconsistent with `map` and `chain`\r\n\r\n```\r\nmap :: (this: A, f: A => B) => MyType<B>\r\nchain :: (this: A, f: A => MyType<B>) => MyType<B>\r\nap :: (this: MyType<A => B>, x: MyType<A>) => MyType<B>\r\n\r\n// sorry about made up types lang, I hope it's clear what I mean here\r\n```\r\n\r\nIn `map` and `chain` value goes first and function goes second, in `ap` the other way around.\r\n\r\n### It's impossible to type with Flow and probably other type systems\r\n\r\n... or at least hard, and I didn't figured out how to do it.\r\n\r\n```js\r\n// @flow\r\n\r\n// With current arguments order we have to use `any`, and therefore loose type info\r\nclass MyType<A> {\r\n  ap(other: MyType<any>): MyType<any>\r\n}\r\n\r\n// With reversed order it's straightforward\r\nclass MyType<A> {\r\n  ap<B>(other: MyType<A => B>): MyType<B>\r\n}\r\n```\r\n\r\nI understand this is a braking change that will probably break a lot of code. But I just want to open this discussion, and hear what others think. Maybe this is a pain point for many people, and it would be reasonable to make the change."},"comment":{"url":"https://api.github.com/repos/fantasyland/fantasy-land/issues/comments/235089027","html_url":"https://github.com/fantasyland/fantasy-land/issues/144#issuecomment-235089027","issue_url":"https://api.github.com/repos/fantasyland/fantasy-land/issues/144","id":235089027,"user":{"login":"SimonRichardson","id":2562584,"avatar_url":"https://avatars.githubusercontent.com/u/2562584?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonRichardson","html_url":"https://github.com/SimonRichardson","followers_url":"https://api.github.com/users/SimonRichardson/followers","following_url":"https://api.github.com/users/SimonRichardson/following{/other_user}","gists_url":"https://api.github.com/users/SimonRichardson/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonRichardson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonRichardson/subscriptions","organizations_url":"https://api.github.com/users/SimonRichardson/orgs","repos_url":"https://api.github.com/users/SimonRichardson/repos","events_url":"https://api.github.com/users/SimonRichardson/events{/privacy}","received_events_url":"https://api.github.com/users/SimonRichardson/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T21:20:35Z","updated_at":"2016-07-25T21:20:35Z","body":"https://github.com/fantasyland/fantasy-land/issues/50#issuecomment-27708812"}}
{"actor":{"display_login":"SimonRichardson"}}