This article delves into the unique concept in Haskell where side effects are first-class values, allowing for the storage of effectful computations for later use. Surprisingly, when side effect functions are called and stored in lists or data structures, no actual side effects are executed until explicitly triggered. The article also explores the use of functions like fmap, liftA2, and sequenceA to manipulate and combine side effects, providing a structured approach to handling procedural code in Haskell. By showcasing the power of equational reasoning and discipline in managing side effects, Haskell challenges traditional programming paradigms, emphasizing refactorability and control over unintended side effects.
https://entropicthoughts.com/haskell-procedural-programming