{"action":"created","issue":{"url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/217","labels_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/217/labels{/name}","comments_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/217/comments","events_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/217/events","html_url":"https://github.com/slamdata/purescript-halogen/issues/217","id":113811453,"number":217,"title":"Communication from grandchild to grandparent","user":{"login":"themoritz","id":3522732,"avatar_url":"https://avatars.githubusercontent.com/u/3522732?v=3","gravatar_id":"","url":"https://api.github.com/users/themoritz","html_url":"https://github.com/themoritz","followers_url":"https://api.github.com/users/themoritz/followers","following_url":"https://api.github.com/users/themoritz/following{/other_user}","gists_url":"https://api.github.com/users/themoritz/gists{/gist_id}","starred_url":"https://api.github.com/users/themoritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themoritz/subscriptions","organizations_url":"https://api.github.com/users/themoritz/orgs","repos_url":"https://api.github.com/users/themoritz/repos","events_url":"https://api.github.com/users/themoritz/events{/privacy}","received_events_url":"https://api.github.com/users/themoritz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-28T12:37:48Z","updated_at":"2015-10-28T16:18:19Z","closed_at":null,"body":"It is not clear to me how communication from a grandchild component to a grandparent component is working/will be working in halogen.\r\n\r\nCommunication from grandparent to grandchild (both query and action) is not a problem, since, when the parent is evaluating the actions that are called from the grandchild, it can always call actions on the grandchildren.\r\n\r\nHowever, when peeking (this is how currently communication from child to parent is implemented), the parent has no way of issuing actions in its own query algebra that can then be peeked into by the grandparent, and therefore, messages from the child cannot \"bubble\" up the hierarchy.\r\n\r\nWhat are the options at the moment?\r\n\r\n* @garyb mentions in #184 that components can peek arbitrarily deep, but I cannot figure out how this would look like. If this will be the best practice way of doing it, adding an example would be great.\r\n\r\n* Maybe there is some way to feed input into the root component (similar to the driver, but from any descendant component in the app), so that it can then trickle down the hierarchy? Independent of the technical possibilities, this would be a nice feature, since it would cover many use cases without the need to carry messages up to the root and then down to other components."},"comment":{"url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/comments/151897985","html_url":"https://github.com/slamdata/purescript-halogen/issues/217#issuecomment-151897985","issue_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/217","id":151897985,"user":{"login":"jdegoes","id":156745,"avatar_url":"https://avatars.githubusercontent.com/u/156745?v=3","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},"created_at":"2015-10-28T16:18:19Z","updated_at":"2015-10-28T16:18:19Z","body":"Right now `peek` observes the child input and then produces a parent output. But what if `peek` observed the child input and produced a parent input? i.e. 'When my child is told to do X, tell me to do Y.'\r\n\r\nBasically, \"raising actions in the parent\" is as powerful as you need, you don't need that *and* current peek, AFAICS.\r\n\r\nThat said, I think there's something even more general here we're ignoring: it'd be nice to do fully \"self-contained\" communication by proving a child's output algebra `g'` can be expressed in terms of the parent's input algebra `f`. (Maybe that's another way of stating the above?) It's sort of a way of saying, \"I don't need to do anything here, my parent can do it for me, and here's the proof that my output can be translated into the parent input.\"\r\n\r\ni.e. during \"installation\" you provide some way of pulling off and / or translating the child's output (not necessarily `g`) to both the parent output and the parent input, so you can decide on just how self-contained this is."}}