{"action":"created","issue":{"url":"https://api.github.com/repos/scalaz/scalaz-zio/issues/263","repository_url":"https://api.github.com/repos/scalaz/scalaz-zio","labels_url":"https://api.github.com/repos/scalaz/scalaz-zio/issues/263/labels{/name}","comments_url":"https://api.github.com/repos/scalaz/scalaz-zio/issues/263/comments","events_url":"https://api.github.com/repos/scalaz/scalaz-zio/issues/263/events","html_url":"https://github.com/scalaz/scalaz-zio/issues/263","id":362990941,"node_id":"MDU6SXNzdWUzNjI5OTA5NDE=","number":263,"title":"Make testing IO programs easier","user":{"login":"jdegoes","id":156745,"node_id":"MDQ6VXNlcjE1Njc0NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/156745?v=4","gravatar_id":"","url":"https://api.github.com/users/jdegoes","html_url":"https://github.com/jdegoes","followers_url":"https://api.github.com/users/jdegoes/followers","following_url":"https://api.github.com/users/jdegoes/following{/other_user}","gists_url":"https://api.github.com/users/jdegoes/gists{/gist_id}","starred_url":"https://api.github.com/users/jdegoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdegoes/subscriptions","organizations_url":"https://api.github.com/users/jdegoes/orgs","repos_url":"https://api.github.com/users/jdegoes/repos","events_url":"https://api.github.com/users/jdegoes/events{/privacy}","received_events_url":"https://api.github.com/users/jdegoes/received_events","type":"User","site_admin":false},"labels":[{"id":938355727,"node_id":"MDU6TGFiZWw5MzgzNTU3Mjc=","url":"https://api.github.com/repos/scalaz/scalaz-zio/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scalaz/scalaz-zio/milestones/1","html_url":"https://github.com/scalaz/scalaz-zio/milestone/1","labels_url":"https://api.github.com/repos/scalaz/scalaz-zio/milestones/1/labels","id":3507802,"node_id":"MDk6TWlsZXN0b25lMzUwNzgwMg==","number":1,"title":"1.0.0","description":"","creator":{"login":"jdegoes","id":156745,"node_id":"MDQ6VXNlcjE1Njc0NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/156745?v=4","gravatar_id":"","url":"https://api.github.com/users/jdegoes","html_url":"https://github.com/jdegoes","followers_url":"https://api.github.com/users/jdegoes/followers","following_url":"https://api.github.com/users/jdegoes/following{/other_user}","gists_url":"https://api.github.com/users/jdegoes/gists{/gist_id}","starred_url":"https://api.github.com/users/jdegoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdegoes/subscriptions","organizations_url":"https://api.github.com/users/jdegoes/orgs","repos_url":"https://api.github.com/users/jdegoes/repos","events_url":"https://api.github.com/users/jdegoes/events{/privacy}","received_events_url":"https://api.github.com/users/jdegoes/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":23,"state":"open","created_at":"2018-07-19T00:16:49Z","updated_at":"2018-09-24T00:21:40Z","due_on":"2018-11-01T07:00:00Z","closed_at":null},"comments":76,"created_at":"2018-09-24T00:21:39Z","updated_at":"2018-10-02T21:05:22Z","closed_at":null,"author_association":"MEMBER","body":"Testing IO programs is not easy right now. One must either use heavy-duty, type-unsafe, and dysfunctional mocking machinery from the world of Java, or one must invent a lot of custom and complex machinery for use with final tagless style.\r\n\r\nTesting IO programs should be easy, which means that it should be possible to make programs that are polymorphic in the effect type, so that either `IO` may be used, or a hypothetical `TestIO`.\r\n\r\nThis ticket tracks the work involved in order to reach this goal.\r\n\r\n - [ ] Identify the minimal set of operations necessary to implement the rest of IO (likely smaller than the case classes that extend `IO`)\r\n - [ ] Abstract over these operations in an `Effect[F[_, _]]` type class, and create an instance of the type class for `IO`\r\n - [ ] Create `EffectSyntax[F[_, _]]` class, which can add methods onto any `Effect: F`. Importing `scalaz.zio._` should bring the syntax into scope automatically, without requiring additional imports.\r\n - [ ] Move all non-minimal methods of the `IO` class into `EffectSyntax[F[_, _]]`, and ensure no code is broken.\r\n - [ ] Create `EffectFunctions` class, which can add top-level helper functions for any `Effect`-like data type.\r\n - [ ] Move all functions of `IO` object into `EffectFunctions[F[_, _]]`, have the `IO` companion object extend `EffectFunctions` (specialized for `IO`), and ensure no code is broken\r\n - [ ] Use whatever Scaladoc tricks are necessary to make things appear in obvious places\r\n\r\nThere are a few details:\r\n\r\n1. First, `Effect` cannot include `sync` or `async`, since these methods are incompatible with testing code. However, they can include all other primitive operations that do not wrap effectful code, including `asyncIO` / `asyncPure`.\r\n2. Second, some structures will have to be generalized, most notably `Fiber`, which will now have to be parameterized over `F[_, _]`; probably `Async`, which can hide `IO` values; and maybe `Ref` (see next point).\r\n3. Third, it's possible `Ref` will have to go into the core set of `Effect` operations, e.g. `def newRef[A](a: A): F[Nothing, Ref[F, A]]`. This might be enough to make `Promise` and then everything else polymorphic in the effect type, which is a desirable goal of this ticket (if not necessary since it can always be done later if difficulties arise).\r\n\r\nOnce all these steps have been completed, then it will be possible to introduce `TestIO` data type, and the user won't have to implement the numerous methods that make IO actually useful. It will only be necessary to implement a few key methods, and of course, we will provide `TestIO` separately in a later ticket, to make the task even easier.\r\n\r\n/cc @mmenestret "},"comment":{"url":"https://api.github.com/repos/scalaz/scalaz-zio/issues/comments/426430098","html_url":"https://github.com/scalaz/scalaz-zio/issues/263#issuecomment-426430098","issue_url":"https://api.github.com/repos/scalaz/scalaz-zio/issues/263","id":426430098,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjQzMDA5OA==","user":{"login":"alexknvl","id":559086,"node_id":"MDQ6VXNlcjU1OTA4Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/559086?v=4","gravatar_id":"","url":"https://api.github.com/users/alexknvl","html_url":"https://github.com/alexknvl","followers_url":"https://api.github.com/users/alexknvl/followers","following_url":"https://api.github.com/users/alexknvl/following{/other_user}","gists_url":"https://api.github.com/users/alexknvl/gists{/gist_id}","starred_url":"https://api.github.com/users/alexknvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexknvl/subscriptions","organizations_url":"https://api.github.com/users/alexknvl/orgs","repos_url":"https://api.github.com/users/alexknvl/repos","events_url":"https://api.github.com/users/alexknvl/events{/privacy}","received_events_url":"https://api.github.com/users/alexknvl/received_events","type":"User","site_admin":false},"created_at":"2018-10-02T21:05:22Z","updated_at":"2018-10-02T21:05:22Z","author_association":"NONE","body":"@Milyardo \r\n\r\n> Isn't that why we're writing tests instead of relying on the compiler to find bugs for us?\r\n\r\nHow would you test that nothing in your code uses `sync` despite being given access to it and unless it is in some blessed parts of the code like `MVar`?"}}
{"actor":{"display_login":"alexknvl"}}