So in another subthread I compared two code samples. One in Haskell:
main = do
putStrLn "Hello, what's your name?"
name <- getLine
putStrLn $ "Hello " ++ name
And one in JavaScript: function main() {
let name = prompt('Hello, what is your name?');
alert('Hello, ' + name);
}
My claim is that either both have side effects or neither. In both cases the definition of a function does not in itself have side effects, and the function can be passed around and manipulated without being executed. But when the function is executed, it causes side effects.Haskell have the feature that the type system can statically verify if functions are pure or not. This is very cool, but it does not change the semantics or purity of a function, it just verifies it statically.