Introduction
Most languages let functions do anything: change variables, print, read files, crash. Haskell, released in 1990, forbids most of that, and programmers who learn it often say it changed how they write every other language. It is a purely functional language: functions have no side effects, data never changes, and the type system catches whole classes of bugs before the program runs. It is less a tool for every job than a way of thinking that leaks, usefully, into everything else you write.
Purity, types, and laziness
Haskell's model rests on a few distinctive ideas:
Purity : a function, given the same inputs, always returns the same output and changes nothing.β¦