Procedures in a Pure Language

Featured image of post Effects without Side-Effects

Effects without Side-Effects

Part of the Procedures in a Pure Language series

In my post on Procedures in a Pure Language, I discuss how even pure functional languages can be used to create procedures that have effects, and how that is how things should be. I propose a little language where these impure procedures can coexist with pure functions in a way that makes the line between pure and impure very clear. In this post, I propose adding a stricture to this language that ensures that, while procedures can have effects, they cannot have side-effects.
Featured image of post Procedures in a Pure Language

Procedures in a Pure Language

Part of the Procedures in a Pure Language series

The Problem The fact that you can write procedures, which produce side-effects, in Haskell, which is supposed to be a pure language, can be confusing. I think the key to clearing up the confusion is to understand that most Haskell programs are actually programs that produce programs – like preprocessors in CPP. Conal Elliott’s post The C language is purely functional explores this idea. The Haskell language itself is pure. When evaluated, Haskell expressions have no side effects, and are referentially transparent.