functional programming

I’m surprised when functional programmers say bad things about Scala

I’m surprised when many functional programmers feel the need to say something bad about Scala. As a community, that makes them seem like a bunch of people who aren’t very nice. There are things I don’t like about Haskell, F#, Lisp, Scala, Kotlin, Go, Perl, PHP, Python, C, C++, etc., but I don’t feel the need to take pot shots at any languages or individuals.

Scala: What do “effect” and “effectful” mean in functional programming?

When you get started with functional programming (FP) a common question you’ll have is, “What is an effect in functional programming?” You’ll hear advanced FPers use the words effects and effectful, but rarely do you get a definition of what they mean.

Effects are related to monads

The first step in the process is to say that effects are related to monads, so you have to know a little bit about monads to understand effects.

Scala while and do/while loops (syntax, examples)

Once I got into functional programming I generally quit using while loops and do/while loops in Scala, but the language has both of them. Here’s the general syntax:

// while loop
while(condition) {
    statement(a)
    statement(b)
}

// do-while
do {
   statement(a)
   statement(b)
} 
while(condition)

Scala while loop syntax

Here’s an example of a while loop:

Scala: “IO monad doesn’t make a function pure; it just makes it obvious it’s impure” alvin July 21, 2018 - 11:15am

I always find it confusing when people claim that the IO monad somehow makes an impure function pure. Frankly, I think that argument does a confusing disservice to people who are trying to learn functional programming (FP).