{"action":"created","issue":{"url":"https://api.github.com/repos/typelevel/cats/issues/1210","repository_url":"https://api.github.com/repos/typelevel/cats","labels_url":"https://api.github.com/repos/typelevel/cats/issues/1210/labels{/name}","comments_url":"https://api.github.com/repos/typelevel/cats/issues/1210/comments","events_url":"https://api.github.com/repos/typelevel/cats/issues/1210/events","html_url":"https://github.com/typelevel/cats/issues/1210","id":165962582,"number":1210,"title":"Better accommodate MTL style","user":{"login":"adelbertc","id":1332980,"avatar_url":"https://avatars.githubusercontent.com/u/1332980?v=3","gravatar_id":"","url":"https://api.github.com/users/adelbertc","html_url":"https://github.com/adelbertc","followers_url":"https://api.github.com/users/adelbertc/followers","following_url":"https://api.github.com/users/adelbertc/following{/other_user}","gists_url":"https://api.github.com/users/adelbertc/gists{/gist_id}","starred_url":"https://api.github.com/users/adelbertc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelbertc/subscriptions","organizations_url":"https://api.github.com/users/adelbertc/orgs","repos_url":"https://api.github.com/users/adelbertc/repos","events_url":"https://api.github.com/users/adelbertc/events{/privacy}","received_events_url":"https://api.github.com/users/adelbertc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/typelevel/cats/milestones/2","html_url":"https://github.com/typelevel/cats/milestones/cats-1.0.0","labels_url":"https://api.github.com/repos/typelevel/cats/milestones/2/labels","id":1201589,"number":2,"title":"cats-1.0.0","description":"","creator":{"login":"ceedubs","id":977929,"avatar_url":"https://avatars.githubusercontent.com/u/977929?v=3","gravatar_id":"","url":"https://api.github.com/users/ceedubs","html_url":"https://github.com/ceedubs","followers_url":"https://api.github.com/users/ceedubs/followers","following_url":"https://api.github.com/users/ceedubs/following{/other_user}","gists_url":"https://api.github.com/users/ceedubs/gists{/gist_id}","starred_url":"https://api.github.com/users/ceedubs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceedubs/subscriptions","organizations_url":"https://api.github.com/users/ceedubs/orgs","repos_url":"https://api.github.com/users/ceedubs/repos","events_url":"https://api.github.com/users/ceedubs/events{/privacy}","received_events_url":"https://api.github.com/users/ceedubs/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":19,"state":"open","created_at":"2015-07-09T22:28:28Z","updated_at":"2016-08-20T04:49:14Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-07-17T06:02:56Z","updated_at":"2016-08-31T18:23:51Z","closed_at":null,"body":"One issue with the current approach is if you want to do MTL style programming, you end up having duplication. A short, contrived, example:\r\n\r\n```scala\r\ntrait MonadMagic[F[_]] extends Monad[F] {\r\n  def magic: F[Int]\r\n}\r\n```\r\n\r\nNow I want to define `MonadMagic[Option]`.. but that means I also need to re-implement the `Monad` `flatMap` and `pure` methods, which leads to duplication and makes me uncomfortable. \r\n\r\nI suppose it could be solved by putting the `Monad[Option]` definition in a `trait` and exposing it for people to mix-in.. but then we'd have to do it for every data type. Which maybe isn't a big deal? But perhaps a deficiency of the current approach.\r\n\r\nI suppose you could also do something like\r\n\r\n```scala\r\ntrait MonadMagic[F[_]] {\r\n  def monad: Monad[F]\r\n}\r\n```\r\n\r\nand provide an implicit conversion `[F]MonadMagic[F] => Monad[F]` but that departs from how we are currently encoding things.\r\n\r\nI find some solution to this is important so as to not hinder MTL style programming which I find is an elegant way to encode EDSLs like `Free` modulo the need to explicitly reify the AST and thus presumably more performant."},"comment":{"url":"https://api.github.com/repos/typelevel/cats/issues/comments/243855146","html_url":"https://github.com/typelevel/cats/issues/1210#issuecomment-243855146","issue_url":"https://api.github.com/repos/typelevel/cats/issues/1210","id":243855146,"user":{"login":"alexandru","id":11753,"avatar_url":"https://avatars.githubusercontent.com/u/11753?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandru","html_url":"https://github.com/alexandru","followers_url":"https://api.github.com/users/alexandru/followers","following_url":"https://api.github.com/users/alexandru/following{/other_user}","gists_url":"https://api.github.com/users/alexandru/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandru/subscriptions","organizations_url":"https://api.github.com/users/alexandru/orgs","repos_url":"https://api.github.com/users/alexandru/repos","events_url":"https://api.github.com/users/alexandru/events{/privacy}","received_events_url":"https://api.github.com/users/alexandru/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T18:23:51Z","updated_at":"2016-08-31T18:23:51Z","body":"In [Monix](https://monix.io) we have this package called `monix.types` in which I compiled a bunch of needed type-classes to support the types exposed in Monix and to allow me to translate them in corresponding Cats and Scalaz type instances, an idea I got from [djspiewak/shims](https://github.com/djspiewak/shims).\r\n\r\nI recently switched the type-class encoding used to that in Scato / Scalaz 8. I instantly got rid of things like `MonadError`, `Bimonad`, `MonadPlus` and others. It's actually amazing, because I have a mini-Cats in my project for about 60 KB. And I also have an `Enumerator[F[_], A]` type that I'm working on, with a type-class based design. And this encoding *feels* really nice."}}
{"actor":{"display_login":"alexandru"}}