Richard Feldman, "The Functional Purity Inference Plan"
It’s common for imperative programming languages to announce that they’re adding some new features to support a functional style of programming in that language. The FP experience in those languages is never quite as smooth as it is in functional-first languages, but it’s still appreciated when that’s the style of code you want to write.
The Roc programming language, which has historically been a purely functional programming language, is planning to add some new features to support an imperative style of programming. The imperative experience in Roc will never quite be as smooth as it is in imperative-first languages, but there are some situations when an imperative style genuinely seems like the best fit for the problem at hand.
Some of the new features are familiar – a `return` statement, `for` loops, and opt-in reassignable variables – but the headline feature is “Purity Inference.” With Purity Inference, functions can be either pure or effectful, and the type system tracks which is which so you never have to guess. Both styles of function are called the same way, so there’s no IO/Promise/Future/Task wrapper. But that’s not all…for the full plan, you’ll have to see the talk!