{"action":"created","issue":{"url":"https://api.github.com/repos/alexmingoia/purescript-pux/issues/65","repository_url":"https://api.github.com/repos/alexmingoia/purescript-pux","labels_url":"https://api.github.com/repos/alexmingoia/purescript-pux/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/alexmingoia/purescript-pux/issues/65/comments","events_url":"https://api.github.com/repos/alexmingoia/purescript-pux/issues/65/events","html_url":"https://github.com/alexmingoia/purescript-pux/issues/65","id":175112986,"number":65,"title":"Subscriptions (Elm 0.17)","user":{"login":"menelaos","id":7543610,"avatar_url":"https://avatars.githubusercontent.com/u/7543610?v=3","gravatar_id":"","url":"https://api.github.com/users/menelaos","html_url":"https://github.com/menelaos","followers_url":"https://api.github.com/users/menelaos/followers","following_url":"https://api.github.com/users/menelaos/following{/other_user}","gists_url":"https://api.github.com/users/menelaos/gists{/gist_id}","starred_url":"https://api.github.com/users/menelaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/menelaos/subscriptions","organizations_url":"https://api.github.com/users/menelaos/orgs","repos_url":"https://api.github.com/users/menelaos/repos","events_url":"https://api.github.com/users/menelaos/events{/privacy}","received_events_url":"https://api.github.com/users/menelaos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-05T18:12:44Z","updated_at":"2016-09-06T16:31:33Z","closed_at":null,"body":"What are your thoughts on Elm 0.17-like [`subscriptions`](http://elm-lang.org/blog/farewell-to-frp)?\r\n\r\nFrom what I can tell there are basically two advantages to signals:\r\n\r\n1. The ability to unsubscribe from subscriptions. This seems especially useful\r\nfor e.g. `MouseMove` events.\r\n2. To encapsulate functionality, such as e.g. retrying AJAX requests.\r\n\r\nIt should also make the architecture simpler in some cases:\r\nSuppose there's a deeply nested component in your app that needs to know about window dimensions. With the current architecture you would need to feed `Signal.DOM.windowDimensions` to the `inputs` array at the top-level and manually pass that information down your component tree either via props or via actions.\r\n\r\nWith the subscription-based approach, it should be possible to have a deeply nested component declare that it wants to listen to window dimensions and let the framework take care of the rest.\r\n\r\n```purescript\r\n-- Deeply nested component\r\ndata Action = ResizeEvent WindowDimensions\r\n\r\nupdateSub :: Action -> Model -> Sub Action\r\nupdateSub _ _ = Subscription.DOM.windowDimensions ResizeEvent\r\n\r\n-- Intermediate components would simply map over the child components\r\ndata Action = ChildAction Child.Action\r\n\r\nupdateSub :: Action -> Model -> Sub Action\r\nupdateSub (ChildAction act) state =\r\n  possiblyLocalSubscriptions <> map ChildAction (Child.updateSub act state.childState)\r\n```\r\n\r\nWhat do you think about this?\r\n"},"comment":{"url":"https://api.github.com/repos/alexmingoia/purescript-pux/issues/comments/245008877","html_url":"https://github.com/alexmingoia/purescript-pux/issues/65#issuecomment-245008877","issue_url":"https://api.github.com/repos/alexmingoia/purescript-pux/issues/65","id":245008877,"user":{"login":"spicydonuts","id":715921,"avatar_url":"https://avatars.githubusercontent.com/u/715921?v=3","gravatar_id":"","url":"https://api.github.com/users/spicydonuts","html_url":"https://github.com/spicydonuts","followers_url":"https://api.github.com/users/spicydonuts/followers","following_url":"https://api.github.com/users/spicydonuts/following{/other_user}","gists_url":"https://api.github.com/users/spicydonuts/gists{/gist_id}","starred_url":"https://api.github.com/users/spicydonuts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spicydonuts/subscriptions","organizations_url":"https://api.github.com/users/spicydonuts/orgs","repos_url":"https://api.github.com/users/spicydonuts/repos","events_url":"https://api.github.com/users/spicydonuts/events{/privacy}","received_events_url":"https://api.github.com/users/spicydonuts/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T16:31:33Z","updated_at":"2016-09-06T16:31:33Z","body":"Some extra thoughts:\r\n* Will this start to overlap with the `purescript-elm` effort or would Pux want to push a different architecture because `purescript-elm` is already aiming to fill that gap?\r\n* Can subscriptions be based on something else that exists?  (`purescript-elm` or `purescript-observable` + custom stuff, etc etc)"}}
{"actor":{"display_login":"spicydonuts"}}