Hacker News new | ask | show | jobs
by mrkeen 803 days ago
Or another example:

  where
  genBranchLabels = do
      (,,,) <$> freshBranchLabel "if_"
            <*> freshBranchLabel "then_"
            <*> freshBranchLabel "else_"
            <*> freshBranchLabel "endif_"
instead of:

  Cg<Tuple4<String, String, String, String>> genBranchLabels() {
      return freshBranchLabel("if_")
               .flatMap(i -> freshBranchLabel("then_")
                 .flatMap(th -> freshBranchLabel("else_")
                    .flatMap(el -> freshBranchLabel("endif_")
                      .map(ei -> new Tuple4<>(i, th, el, ei)))));
  }