{"action":"created","issue":{"url":"https://api.github.com/repos/tel/scala-tk/issues/4","repository_url":"https://api.github.com/repos/tel/scala-tk","labels_url":"https://api.github.com/repos/tel/scala-tk/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/tel/scala-tk/issues/4/comments","events_url":"https://api.github.com/repos/tel/scala-tk/issues/4/events","html_url":"https://github.com/tel/scala-tk/issues/4","id":163420903,"number":4,"title":"Introspection of Effects","user":{"login":"tel","id":1141,"avatar_url":"https://avatars.githubusercontent.com/u/1141?v=3","gravatar_id":"","url":"https://api.github.com/users/tel","html_url":"https://github.com/tel","followers_url":"https://api.github.com/users/tel/followers","following_url":"https://api.github.com/users/tel/following{/other_user}","gists_url":"https://api.github.com/users/tel/gists{/gist_id}","starred_url":"https://api.github.com/users/tel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tel/subscriptions","organizations_url":"https://api.github.com/users/tel/orgs","repos_url":"https://api.github.com/users/tel/repos","events_url":"https://api.github.com/users/tel/events{/privacy}","received_events_url":"https://api.github.com/users/tel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-01T15:35:16Z","updated_at":"2016-07-01T17:12:28Z","closed_at":null,"body":"Right now effects are essentially Store comonads\r\n\r\n```haskell\r\nStore i o = (i, i -> o)\r\n```\r\n\r\nwhere the function is allowed to be a side-effecting Scala procedure. This means that having a stack of effects will essentially not help you at all to know what's going on. There is no introspection possible.\r\n\r\nIf instead we revert back to the idea \r\n\r\n```haskell\r\nStore i o = (i, FFI i o)\r\n```\r\n\r\nthen with Scala's open type hierarchies (and perhaps `FFI[I, O] extends Function1[I, O]`) we can at least allow for the opportunity to provide inspection. To this end perhaps we're better off with\r\n\r\n```scala\r\ncase class Effect[E[_, _] <: FFI, Req, Resp, R](\r\n  ffi: E[Req, Resp],\r\n  request: Req,\r\n  fail: Throwable => R,\r\n  continue: Resp => R\r\n)\r\n```\r\n\r\nthe advantage here is that when this floats to the top in `Tk` we have the option to use our knowledge of the supertype of all `FFI` (in some subtree) effects to introspect things."},"comment":{"url":"https://api.github.com/repos/tel/scala-tk/issues/comments/230000182","html_url":"https://github.com/tel/scala-tk/issues/4#issuecomment-230000182","issue_url":"https://api.github.com/repos/tel/scala-tk/issues/4","id":230000182,"user":{"login":"tel","id":1141,"avatar_url":"https://avatars.githubusercontent.com/u/1141?v=3","gravatar_id":"","url":"https://api.github.com/users/tel","html_url":"https://github.com/tel","followers_url":"https://api.github.com/users/tel/followers","following_url":"https://api.github.com/users/tel/following{/other_user}","gists_url":"https://api.github.com/users/tel/gists{/gist_id}","starred_url":"https://api.github.com/users/tel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tel/subscriptions","organizations_url":"https://api.github.com/users/tel/orgs","repos_url":"https://api.github.com/users/tel/repos","events_url":"https://api.github.com/users/tel/events{/privacy}","received_events_url":"https://api.github.com/users/tel/received_events","type":"User","site_admin":false},"created_at":"2016-07-01T17:12:28Z","updated_at":"2016-07-01T17:12:28Z","body":"```scala\r\ntrait Effect[Req, Resp, R] {\r\n  def apply(req: Req): Resp\r\n  val request: Req\r\n  def fail(t: Throwable): R\r\n  def continue(resp: Resp): R\r\n}\r\n```\r\n\r\nor\r\n\r\n```scala\r\ntrait Effect[R] {\r\n  type Req\r\n  type Resp\r\n  def apply(req: Req): Resp\r\n  def fail(t: Throwable): R\r\n  def continue(resp: Resp): R\r\n\r\n  val request: Req\r\n}\r\n```\r\n\r\nOr with the \"Thunk-y\" supertype\r\n\r\n```scala\r\ntrait Effect0[R] {\r\n  type Resp\r\n  lazy val response: Resp\r\n  def fail(t: Throwable): R\r\n  def continue(resp: Resp): R\r\n}\r\n\r\ntrait Effect1[R] extends Effect0[R] {\r\n  type Req\r\n  def apply(req: Req): Resp\r\n  val request: Req\r\n  lazy val response: Resp = apply(request)\r\n}\r\n```"}}
{"actor":{"display_login":"tel"}}