{"action":"created","issue":{"url":"https://api.github.com/repos/typelevel/cats/issues/1318","repository_url":"https://api.github.com/repos/typelevel/cats","labels_url":"https://api.github.com/repos/typelevel/cats/issues/1318/labels{/name}","comments_url":"https://api.github.com/repos/typelevel/cats/issues/1318/comments","events_url":"https://api.github.com/repos/typelevel/cats/issues/1318/events","html_url":"https://github.com/typelevel/cats/issues/1318","id":172469483,"number":1318,"title":"Generalise MonoidK","user":{"login":"kcsongor","id":313596,"avatar_url":"https://avatars.githubusercontent.com/u/313596?v=3","gravatar_id":"","url":"https://api.github.com/users/kcsongor","html_url":"https://github.com/kcsongor","followers_url":"https://api.github.com/users/kcsongor/followers","following_url":"https://api.github.com/users/kcsongor/following{/other_user}","gists_url":"https://api.github.com/users/kcsongor/gists{/gist_id}","starred_url":"https://api.github.com/users/kcsongor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcsongor/subscriptions","organizations_url":"https://api.github.com/users/kcsongor/orgs","repos_url":"https://api.github.com/users/kcsongor/repos","events_url":"https://api.github.com/users/kcsongor/events{/privacy}","received_events_url":"https://api.github.com/users/kcsongor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-22T14:38:29Z","updated_at":"2016-08-22T17:53:38Z","closed_at":null,"body":"I was looking at various type classes, and this sentence caught my eye: \"MonoidK is a universal monoid which operates on kinds.\" - great, this is a really useful abstraction!\r\nHowever, I couldn't help but think that this could be generalised further to general monoidal categories, not just the cartesian closed category of scala types.\r\nIn general, a monoidal category is a category equipped with an associative bifunctor `F x F -> F` (+ an identity object). Now, MonoidK as it exists today, is specialised to cartesian monoidal categories, i.e. ones in which the the product looks like `(F, F) -> F`, so we can smash two F's into one F. (This specialisation takes place in the type of `combine`, which takes two `F[A]`s).\r\n\r\nMy proposal is to abstract away from the cartesian product, and write it in terms of arbitrary products, so combine would be something like `Product[F, F] => F`. Then the current formulation would be something like `Cartesian[F, F] => F`, with `type Cartesian[A, B] = (A, B)`. (for identity, we need a `Void` type, so `(Void, A) ~ (A, Void) ~ A`)\r\nAnother monoidal category (that is not a cartesian category) is the category of endofunctors. There, `Product` can be thought of as composition of endofunctors, so compose would `Composition[F, F] => F`, which translates to `F[F[A]] => F[A]`.\r\n\r\nWhy is this a good idea?\r\nI guess it demonstrates that a monad is really *just* a monoid in the category of endofunctors. (note the type of `compose` when the product is `Composition` - this is just `join`!) Appropriate t-shirts can then be printed without remorse.\r\n\r\nPS:\r\nIsn't Monoid just MonoidK[Id]?"},"comment":{"url":"https://api.github.com/repos/typelevel/cats/issues/comments/241494600","html_url":"https://github.com/typelevel/cats/issues/1318#issuecomment-241494600","issue_url":"https://api.github.com/repos/typelevel/cats/issues/1318","id":241494600,"user":{"login":"kcsongor","id":313596,"avatar_url":"https://avatars.githubusercontent.com/u/313596?v=3","gravatar_id":"","url":"https://api.github.com/users/kcsongor","html_url":"https://github.com/kcsongor","followers_url":"https://api.github.com/users/kcsongor/followers","following_url":"https://api.github.com/users/kcsongor/following{/other_user}","gists_url":"https://api.github.com/users/kcsongor/gists{/gist_id}","starred_url":"https://api.github.com/users/kcsongor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcsongor/subscriptions","organizations_url":"https://api.github.com/users/kcsongor/orgs","repos_url":"https://api.github.com/users/kcsongor/repos","events_url":"https://api.github.com/users/kcsongor/events{/privacy}","received_events_url":"https://api.github.com/users/kcsongor/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T17:53:38Z","updated_at":"2016-08-22T17:53:38Z","body":"@non @johnynek thanks, I realised slightly after that I was only thinking in terms of the resulting type signature, not how the parameters are quantified, which was an obvious mistake."}}
{"actor":{"display_login":"kcsongor"}}