Purity & IO.


Encapsulating side effects

Haskell strictly separates pure functions from side effects. Effects are encapsulated in types like IO. Pure functions remain testable and predictable.

IO in the main function:

Pure function without effects: