{"action":"created","issue":{"url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/48","labels_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/48/comments","events_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/48/events","html_url":"https://github.com/slamdata/purescript-halogen/issues/48","id":63891496,"number":48,"title":"Child to parent event signalling","user":{"login":"natefaubion","id":144058,"avatar_url":"https://avatars.githubusercontent.com/u/144058?v=3","gravatar_id":"","url":"https://api.github.com/users/natefaubion","html_url":"https://github.com/natefaubion","followers_url":"https://api.github.com/users/natefaubion/followers","following_url":"https://api.github.com/users/natefaubion/following{/other_user}","gists_url":"https://api.github.com/users/natefaubion/gists{/gist_id}","starred_url":"https://api.github.com/users/natefaubion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natefaubion/subscriptions","organizations_url":"https://api.github.com/users/natefaubion/orgs","repos_url":"https://api.github.com/users/natefaubion/repos","events_url":"https://api.github.com/users/natefaubion/events{/privacy}","received_events_url":"https://api.github.com/users/natefaubion/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-24T03:06:04Z","updated_at":"2015-03-24T03:19:57Z","closed_at":null,"body":"Running with a typeahead example, I'm wanting to wrap it up into its own component that I can reuse. It has a decent amount of state and event handlers (clicks, keypresses), but I'm wanting to be able to signal to the parent when the user makes a selection (so basically a custom `onselect` event handler, which is not a DOM event). Communication is currently one way from parent to child, and there's no way for a child to notify a parent with the idioms mentioned in #44 (at least as far as I can tell).\r\n\r\nThe problem with the `<$>` idiom is that it only, and always touches all DOM handlers. So if I do `TAState <$> myTypeahead`, all results from event handlers will always be wrapped (and thus can't be reasonably intercepted by the parent).\r\n\r\nIt seems like you could do another level of wrapping in the handler and do something like `listen TAEvent TAState <$> myTypeahead` where `listen` say wraps with `TAEvent` when given a `Left` to signal the parent, or with `TAState` when given a `Right` if its not signalling the parent. And then the typeahead component would have to make sure to map a `Right` over its inner components. The result given to `TAEvent` would then naturally wrap a sum of possible events raised by the typeahead."},"comment":{"url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/comments/85322948","html_url":"https://github.com/slamdata/purescript-halogen/issues/48#issuecomment-85322948","issue_url":"https://api.github.com/repos/slamdata/purescript-halogen/issues/48","id":85322948,"user":{"login":"natefaubion","id":144058,"avatar_url":"https://avatars.githubusercontent.com/u/144058?v=3","gravatar_id":"","url":"https://api.github.com/users/natefaubion","html_url":"https://github.com/natefaubion","followers_url":"https://api.github.com/users/natefaubion/followers","following_url":"https://api.github.com/users/natefaubion/following{/other_user}","gists_url":"https://api.github.com/users/natefaubion/gists{/gist_id}","starred_url":"https://api.github.com/users/natefaubion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natefaubion/subscriptions","organizations_url":"https://api.github.com/users/natefaubion/orgs","repos_url":"https://api.github.com/users/natefaubion/repos","events_url":"https://api.github.com/users/natefaubion/events{/privacy}","received_events_url":"https://api.github.com/users/natefaubion/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T03:19:57Z","updated_at":"2015-03-24T03:19:57Z","body":"Basically something like this, if this makes sense\r\n\r\n```purescript\r\ndata Respond a b = Respond a | Continue b\r\nlisten :: forall a b r p f. (Functor f) => (a -> r) -> (b -> r) -> HTML p (f (Respond a b)) -> HTML p (f r)\r\n```\r\n\r\nWhich essentially looks like mapping a bimap"}}