News for hackers. Stuff that matters.
Re:Monad Tutorials Timeline by lmm on Thursday April 30, 2026 @06:12AM (#47960382)
Re:Monad Tutorials Timeline by amenghra on Thursday April 30, 2026 @06:55AM (#47960686)
From the very beginning of the article (level 1), I don't see what's wrong with code that looks like the following. Early return seems to fix the "typing this makes me feel ill" part? To me, the following code seems perfectly readable without requiring the reader to know about function composition.

  def doFunctionsInSequence1(): Option[Set[Int]] = {
    val r1 = f1(null)
    if(r1.isEmpty) {
      return None
    }

    val r2 = f2(r1.get)
    if(r2.isEmpty) {
      return None
    }

    return f3(r2.get)
  }
Re:Monad Tutorials Timeline by lmm on Thursday April 30, 2026 @07:35AM (#47960974)
I find that pretty repetitive, but more, having to reason about branching control flow adds a lot of mental overhead that I'd rather spend on my business logic.