Scala, Learning FP By Terminology - FP Impurity

less than 1 minute read

FP Impurity

As a final word I would like to talk about FP and impurity.

I know that sounds like an oxymoron but FP has impurity why? because it’s a cruel world, you have to do IO. FP has no solution for that. FP will tell you do your pure core as big as you can and wrap that impure stuff with IO, it won’t turn it to pure sutff it just wraps it in IO. FP tells you well if you cannot make this function pure at least tell us in it’s signature it’s impure. We like function signatures in FP.

Martin Odersky says Questioning FP

The IO monad does not make a function pure. It just makes it obvious that it’s impure.

So there is no silver bullet, if you start usimg IOMonad it just going to make your explicitly say that they are impure.

Updated:

Leave a Comment