{"action":"created","issue":{"url":"https://api.github.com/repos/japgolly/scalajs-react/issues/264","repository_url":"https://api.github.com/repos/japgolly/scalajs-react","labels_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/264/labels{/name}","comments_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/264/comments","events_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/264/events","html_url":"https://github.com/japgolly/scalajs-react/issues/264","id":143828035,"number":264,"title":"Make Callback.ifTrue take curried parameters.","user":{"login":"ramnivas","id":137002,"avatar_url":"https://avatars.githubusercontent.com/u/137002?v=3","gravatar_id":"","url":"https://api.github.com/users/ramnivas","html_url":"https://github.com/ramnivas","followers_url":"https://api.github.com/users/ramnivas/followers","following_url":"https://api.github.com/users/ramnivas/following{/other_user}","gists_url":"https://api.github.com/users/ramnivas/gists{/gist_id}","starred_url":"https://api.github.com/users/ramnivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramnivas/subscriptions","organizations_url":"https://api.github.com/users/ramnivas/orgs","repos_url":"https://api.github.com/users/ramnivas/repos","events_url":"https://api.github.com/users/ramnivas/events{/privacy}","received_events_url":"https://api.github.com/users/ramnivas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/japgolly/scalajs-react/labels/could","name":"could","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/japgolly/scalajs-react/milestones/5","html_url":"https://github.com/japgolly/scalajs-react/milestones/0.11.0","labels_url":"https://api.github.com/repos/japgolly/scalajs-react/milestones/5/labels","id":1610552,"number":5,"title":"0.11.0","description":"","creator":{"login":"japgolly","id":202935,"avatar_url":"https://avatars.githubusercontent.com/u/202935?v=3","gravatar_id":"","url":"https://api.github.com/users/japgolly","html_url":"https://github.com/japgolly","followers_url":"https://api.github.com/users/japgolly/followers","following_url":"https://api.github.com/users/japgolly/following{/other_user}","gists_url":"https://api.github.com/users/japgolly/gists{/gist_id}","starred_url":"https://api.github.com/users/japgolly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japgolly/subscriptions","organizations_url":"https://api.github.com/users/japgolly/orgs","repos_url":"https://api.github.com/users/japgolly/repos","events_url":"https://api.github.com/users/japgolly/events{/privacy}","received_events_url":"https://api.github.com/users/japgolly/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":5,"state":"open","created_at":"2016-02-28T21:49:28Z","updated_at":"2016-03-30T10:46:02Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-27T16:58:46Z","updated_at":"2016-03-31T02:51:20Z","closed_at":null,"body":"Currently, one needs to write code such as:\r\n```\r\nCallback.ifTrue(<condition>, {\r\n   ...\r\n   // lines of code\r\n   ...\r\n})\r\n```\r\n\r\nIf `Callback.ifTrue` were to be defied as taking curried params, we could code it to look much closer to an `if` statement:\r\n\r\n```\r\nCallback.ifTrue(<condition>) {\r\n   ...\r\n   // lines of code\r\n   ...\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/japgolly/scalajs-react/issues/comments/203726462","html_url":"https://github.com/japgolly/scalajs-react/issues/264#issuecomment-203726462","issue_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/264","id":203726462,"user":{"login":"ramnivas","id":137002,"avatar_url":"https://avatars.githubusercontent.com/u/137002?v=3","gravatar_id":"","url":"https://api.github.com/users/ramnivas","html_url":"https://github.com/ramnivas","followers_url":"https://api.github.com/users/ramnivas/followers","following_url":"https://api.github.com/users/ramnivas/following{/other_user}","gists_url":"https://api.github.com/users/ramnivas/gists{/gist_id}","starred_url":"https://api.github.com/users/ramnivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramnivas/subscriptions","organizations_url":"https://api.github.com/users/ramnivas/orgs","repos_url":"https://api.github.com/users/ramnivas/repos","events_url":"https://api.github.com/users/ramnivas/events{/privacy}","received_events_url":"https://api.github.com/users/ramnivas/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T02:51:20Z","updated_at":"2016-03-31T02:51:20Z","body":"I see your point. \r\n\r\nIf `ifTure` (or `when`) is seen as a shortform for the following, then may be the curried form maps better.\r\n```scala\r\nif (<condition>) {\r\n   scope.modState(...)\r\n} else {\r\n   Callback.empty\r\n}\r\n```\r\n\r\nDuring recent coding I often stumbled in matching parens and braces around `ifTrue`, especially for large body of expressions. But I can see getting used to either form."}}