{"action":"created","issue":{"url":"https://api.github.com/repos/evilsoft/crocks/issues/292","repository_url":"https://api.github.com/repos/evilsoft/crocks","labels_url":"https://api.github.com/repos/evilsoft/crocks/issues/292/labels{/name}","comments_url":"https://api.github.com/repos/evilsoft/crocks/issues/292/comments","events_url":"https://api.github.com/repos/evilsoft/crocks/issues/292/events","html_url":"https://github.com/evilsoft/crocks/issues/292","id":341360763,"node_id":"MDU6SXNzdWUzNDEzNjA3NjM=","number":292,"title":"Defining Monoids as classes than functions returning Object literals","user":{"login":"Vikasg7","id":14152817,"node_id":"MDQ6VXNlcjE0MTUyODE3","avatar_url":"https://avatars3.githubusercontent.com/u/14152817?v=4","gravatar_id":"","url":"https://api.github.com/users/Vikasg7","html_url":"https://github.com/Vikasg7","followers_url":"https://api.github.com/users/Vikasg7/followers","following_url":"https://api.github.com/users/Vikasg7/following{/other_user}","gists_url":"https://api.github.com/users/Vikasg7/gists{/gist_id}","starred_url":"https://api.github.com/users/Vikasg7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vikasg7/subscriptions","organizations_url":"https://api.github.com/users/Vikasg7/orgs","repos_url":"https://api.github.com/users/Vikasg7/repos","events_url":"https://api.github.com/users/Vikasg7/events{/privacy}","received_events_url":"https://api.github.com/users/Vikasg7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-15T23:14:35Z","updated_at":"2018-07-25T05:16:41Z","closed_at":null,"author_association":"NONE","body":"Hello Devs,\r\nI was going through the code in this repo and found out that you have chosen to define monoids as functions returning object literals.  \r\nDon't you think - it would lead to the creation of monoid methods/functions again and again when we map, chain and so on?  Or Why didn't you choose classes over functions to define all monoids like Either, Maybe and so on ?\r\nConsider following example:-  \r\n````javascript\r\n// Defining Monoid as function returning Object literal\r\nfunction Monoid() {\r\n  const map = () => {}\r\n  return { map }\r\n}\r\n\r\nconst i1 = Monoid()\r\nconst i2 = Monoid()\r\nconsole.log(i1.map == i2.map, i1.map === i2.map) // Both return false\r\n// meaning both map methods are different \r\n\r\n// Defining Monoid as class OR defining methods on prototype\r\nclass monoid {\r\n  map() { }\r\n}\r\n\r\nconst t1 = new monoid()\r\nconst t2 = new monoid()\r\nconsole.log(t1.map == t2.map, t1.map === t2.map) // Both return true\r\n// meaning both map methods are same\r\n````\r\nLet me know if you are able to understand the issue. "},"comment":{"url":"https://api.github.com/repos/evilsoft/crocks/issues/comments/407635926","html_url":"https://github.com/evilsoft/crocks/issues/292#issuecomment-407635926","issue_url":"https://api.github.com/repos/evilsoft/crocks/issues/292","id":407635926,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzYzNTkyNg==","user":{"login":"evilsoft","id":3665793,"node_id":"MDQ6VXNlcjM2NjU3OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/3665793?v=4","gravatar_id":"","url":"https://api.github.com/users/evilsoft","html_url":"https://github.com/evilsoft","followers_url":"https://api.github.com/users/evilsoft/followers","following_url":"https://api.github.com/users/evilsoft/following{/other_user}","gists_url":"https://api.github.com/users/evilsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/evilsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evilsoft/subscriptions","organizations_url":"https://api.github.com/users/evilsoft/orgs","repos_url":"https://api.github.com/users/evilsoft/repos","events_url":"https://api.github.com/users/evilsoft/events{/privacy}","received_events_url":"https://api.github.com/users/evilsoft/received_events","type":"User","site_admin":false},"created_at":"2018-07-25T05:16:41Z","updated_at":"2018-07-25T05:16:41Z","author_association":"OWNER","body":"Not only are the Monoids inplemented using the module pattern, but all types are.\r\nThis provides more flexibility in how the internal operations are handled and also allows for encapsulation of the internal value.\r\n\r\nWe have some idea in the works to avoid stack overflows for some operations on Lazy types, but with general use of the lib a user should not run into this very often. Hopefully we will have the bits in play before a huge outcry is heard.\r\n\r\nWe considered using prototypes, but in the long run, using the module pattern provided us with more value for the direction we were going."}}
{"actor":{"display_login":"evilsoft"}}